-
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.
- Loading branch information
1 parent
535758a
commit 81b0565
Showing
15 changed files
with
104 additions
and
123 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import { inlineResolver0, localeString, inlineResolver1 } from "../resolver"; | ||
import { | ||
inlineResolver0, | ||
inlineResolver1, | ||
localeString, | ||
inlineResolver2, | ||
} from "../resolver"; | ||
|
||
// prettier-ignore | ||
export const getPageBySlug = /* groq */` | ||
*[_type == "page" && slug.current == $slug] { ..., ${inlineResolver0("seoTitle")}, gallery { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${inlineResolver1("title")} } } }, sections[] { ..., gallerySection { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${localeString("title")} } } }, textSection { ..., ${localeString("title")} }, featuresSection { ..., ${localeString("title")}, ${localeString("subtitle")} } } }[0] ` | ||
*[_type == "page" && slug.current == $slug] { ..., ${inlineResolver0("seoTitle")}, ${inlineResolver1("pageHeader")}, gallery { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${inlineResolver2("title")} } } }, sections[] { ..., gallerySection { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${localeString("title")} } } }, textSection { ..., ${localeString("title")} }, featuresSection { ..., ${localeString("title")}, ${localeString("subtitle")} } } }[0] ` |
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,5 +1,10 @@ | ||
import { inlineResolver0, localeString, inlineResolver1 } from "../resolver"; | ||
import { | ||
inlineResolver0, | ||
inlineResolver1, | ||
localeString, | ||
inlineResolver2, | ||
} from "../resolver"; | ||
|
||
// prettier-ignore | ||
export const getPages = /* groq */` | ||
*[_type == "page"] { ..., ${inlineResolver0("seoTitle")}, gallery { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${inlineResolver1("title")} } } }, sections[] { ..., gallerySection { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${localeString("title")} } } }, textSection { ..., ${localeString("title")} }, featuresSection { ..., ${localeString("title")}, ${localeString("subtitle")} } } }[0] ` | ||
*[_type == "page"] { ..., ${inlineResolver0("seoTitle")}, ${inlineResolver1("pageHeader")}, gallery { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${inlineResolver2("title")} } } }, sections[] { ..., gallerySection { ..., ${localeString("sectionTitle")}, slides[] { ..., slide { ..., ${localeString("title")} } } }, textSection { ..., ${localeString("title")} }, featuresSection { ..., ${localeString("title")}, ${localeString("subtitle")} } } }[0] ` |
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,3 +1,4 @@ | ||
export * from "./inline-resolver0"; | ||
export * from "./inline-resolver1"; | ||
export * from "./inline-resolver2"; | ||
export * from "./locale-string"; |
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,4 +1,4 @@ | ||
import { type Resolver } from "sanity-generator/types"; | ||
|
||
// prettier-ignore | ||
export const inlineResolver1: Resolver = (name) => ( /* groq */ `"${name}": {"super": "cool"}` ) | ||
export const inlineResolver1: Resolver = (name2) => ( /* groq */ ` "${name2}-wrapped": { "title": ${name2}.title, "subtitle": ${name2}.subtitle } ` ) |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { type Resolver } from "sanity-generator/types"; | ||
|
||
// prettier-ignore | ||
export const inlineResolver2: Resolver = (name) => ( /* groq */ `"${name}": {"super": "cool"}` ) |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {defineField} from 'sanity' | ||
|
||
export const header = (name: string, group = "") => | ||
defineField({ | ||
type: 'object', | ||
name, | ||
group, | ||
fields: [ | ||
{name: 'title', type: 'string'}, | ||
{name: 'subtitle', type: 'string'}, | ||
], | ||
generator: { | ||
resolver: (name: string) => /* groq */ ` | ||
"${name}-wrapped": { | ||
"title": ${name}.title, | ||
"subtitle": ${name}.subtitle | ||
} | ||
`, | ||
}, | ||
}) |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './header' |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {GeneratorSchemaDefinition} from 'sanity-generator/types' | ||
export {} | ||
|
||
declare module 'sanity' { | ||
interface FieldDefinitionBase extends GeneratorSchemaDefinition {} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./inline-resolver0"; | ||
export * from "./inline-resolver1"; | ||
export * from "./locale-string"; | ||
export * from "./special-number"; |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { type Resolver } from "sanity-generator/types"; | ||
|
||
// prettier-ignore | ||
export const localeString: Resolver = (name) => ( /* groq */ ` "${name}": coalesce(${name}[$lang], ${name}.en) ` ) |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { type Resolver } from "sanity-generator/types"; | ||
|
||
// prettier-ignore | ||
export const specialNumber: Resolver = (name) => ( /* groq */ ` "${name}-special-number": ${name} ` ) |
Oops, something went wrong.