Skip to content

Commit

Permalink
add logo and work on posts
Browse files Browse the repository at this point in the history
  • Loading branch information
Highlander-maker committed Jun 17, 2022
1 parent c727732 commit 2a5e0e9
Show file tree
Hide file tree
Showing 7 changed files with 1,025 additions and 946 deletions.
4 changes: 2 additions & 2 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function Header() {
<div className="flex items-center space-x-5">
<Link href="/">
<img
className="w-44 object-contain cursor-pointer"
src="/public/chaintools-logo-black.svg"
className="w-44 h-16 object-contain cursor-pointer"
src="/chaintools-logo-clear.svg"
alt=""
/>
</Link>
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"start": "next start"
},
"dependencies": {
"@sanity/image-url": "^1.0.1",
"next": "latest",
"next-sanity": "^0.5.2",
"react": "18.1.0",
Expand Down
9 changes: 5 additions & 4 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Head from "next/head";
import Link from "next/link";
import Header from "../components/Header";
import { sanityClient} from "../sanity";
import { sanityClient, urlFor } from "../sanity";
import { Post } from "../typings";

interface Props {
Expand Down Expand Up @@ -34,8 +34,8 @@ export default function Home({ posts }: Props) {
</div>

<img
className="hidden md:inline-flex h-32 lg:-full"
src="/public/chaintools-logo-black.svg"
className="hidden md:inline-flex h-36 lg:-full"
src="chaintools-logo-black.svg"
alt=""
/>
</div>
Expand All @@ -46,7 +46,8 @@ export default function Home({ posts }: Props) {
<Link key={post._id} href={`/post/s{post.slug.current}`}>
<div>
<h1> i am a post</h1>
{/* //<img src={urlFor(post.mainImage).url()!} alt="" /> */}

{/* <img src={urlFor(post.mainImage).url()!} alt="" /> */}
</div>
</Link>
))}
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
47 changes: 25 additions & 22 deletions sanity.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
import {
createImageUrlBuilder,
createCurrentUserHook,
createClient,
createImageUrlBuilder,
createCurrentUserHook,
createClient,
} from "next-sanity";

export const config = {
/**
* Find your project ID and dataset in `sanity.json` in your studio project.
* There are considered "public", but you can use enviroment variables
* if you want differ between local dev and production.
*
* https://nextjs.org/docs/basic-features/enviroment-variables
**/
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || "production",
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
apiVersion: "2021-03-25",
/**
* Set useCdn to `false` if your application require the freshest possible
* data always (potentially slightly slower and a bit more expensive).
* Authenticated request (like preview) will always bypass the CDN
**/
useCdn: process.env.NODE_ENV === "production",
/**
* Find your project ID and dataset in `sanity.json` in your studio project.
* These are considered public, but you can use environment variables
* if you want differ between local dev and production.
*
* https://nextjs.org/docs/basic-features/environment-variables
**/
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || "production",
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
apiVersion: "2021-10-21", // Learn more: https://www.sanity.io/docs/api-versioning
/**
* Set useCdn to `false` if your application require the freshest possible
* data always (potentially slightly slower and a bit more expensive).
* Authenticated request (like preview) will always bypass the CDN
**/
useCdn: process.env.NODE_ENV === "production",
};

// Set up the client for fetching data in the getProps page functions
export const sanityClient = createClient(config);

// Helper function for using the current logged in your account
/**
* Set up a helper function for generating Image URLs with only the asset reference data in your documents.
* Read more: https://www.sanity.io/docs/image-url
**/
export const urlFor = (source) => createImageUrlBuilder(config).image(source);

// helper function for using the current logged in user account
export const useCurrentUser = createCurrentUserHook(config);
// Helper function for using the current logged in user account
export const useCurrentUser = createCurrentUserHook(config)
Loading

0 comments on commit 2a5e0e9

Please sign in to comment.