-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from vignesh-gupta/content-dyanamic
Updated the Content dynamically with Sanity
- Loading branch information
Showing
12 changed files
with
160 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
import { createClient, groq } from "next-sanity"; | ||
import clientConfig from '../config' | ||
import clientConfig from "../config"; | ||
|
||
export async function sanityFetch(query: string) { | ||
return createClient(clientConfig).fetch(groq`${query}`); | ||
} | ||
|
||
// TODO: Remove the below function. Just an eg. | ||
export async function getPages(){ | ||
return createClient(clientConfig).fetch( | ||
groq`*[_type == "page"]{ | ||
_id, | ||
_createdAt, | ||
title, | ||
"slug": slug.current, | ||
}` | ||
) | ||
export async function getSkills() { | ||
return sanityFetch(`*[_type == "skill"]{ | ||
_id, | ||
_createdAt, | ||
name, | ||
"icon": icon.asset->url, | ||
}`); | ||
} | ||
|
||
export async function getProjects(featuredOnly = false) { | ||
return sanityFetch(`*[_type == "project" ${featuredOnly ? "&& isFeatured == true " : ""}]{ | ||
_id, | ||
_createdAt, | ||
title, | ||
description, | ||
codeLink, | ||
projectLink, | ||
tags, | ||
isFeatured, | ||
"imgUrl": imgUrl.asset->url | ||
}${featuredOnly ? "[0...3]" : ""}`); | ||
} |