Skip to content

Instantly share code, notes, and snippets.

@1903-development-team
Created September 12, 2022 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1903-development-team/abcc1466bb1ab5c9c690d2a2a1038807 to your computer and use it in GitHub Desktop.
Save 1903-development-team/abcc1466bb1ab5c9c690d2a2a1038807 to your computer and use it in GitHub Desktop.
export const newModules = {
global: `
_type,
_key,
"slug": slug.current,
`,
grid: `
_type == 'grid' => {
_type,
_key,
size,
padding,
paddingTopCalc,
borderWidth,
gridgap,
subscriberHide,
subscriberShow,
"borderTopColor": borderTopColor -> title,
"borderBottomColor": borderBottomColor -> title,
"colorTitle": color->title,
useBGImage,
backgroundImage{${imageMeta}},
backgroundImageMobile{${imageMeta}},
extraWide,
columns[]{
hideForMobile,
hideForDesktop,
sizes[]{
breakpoint,
width,
justify,
align,
start
},
blocks[]{
${blocks}
}
}
}
`,
auth: `
_type == 'auth' => {
_type,
_key,
subscriberHide,
subscriberShow,
customAction
}
`,
profile: `
_type == 'profile' => {
_type,
_key,
subscriberHide,
subscriberShow,
}
`,
textBlock: `
_type == 'textBlock' => {
_type,
_key,
"colorTitle": color->title,
content[]{
${ptContent}
},
textAlign,
maxWidth
}
`,
dotWhack: `
_type == 'dotWhack' => {
_type,
_key,
dotWhackMessage,
dotWhackPlacement,
subscriberHide,
subscriberShow,
}
`,
hero: `
_type == 'hero' => {
_type,
_key,
subscriberHide,
subscriberShow,
content[]{
${ptContent}
},
bgType,
photos{
...,
mobilePhoto{
${imageMeta}
},
desktopPhoto{
${imageMeta}
}
},
video{
id,
title
}
}
`,
marquee: `
_type == 'marquee' => {
_type,
_key,
subscriberHide,
subscriberShow,
items[]{
_type == 'simple' => {
_type,
text
},
_type == 'photo' => {
_type,
"photo": {
${imageMeta}
}
},
_type == 'product' => {
_type,
_id,
"product": *[_type == "product" && _id == ^ ._ref][0]${product}
}
},
speed,
reverse,
pausable
}
`,
dividerPhoto: `
_type == 'dividerPhoto' => {
_type,
_key,
photo{
${imageMeta}
}
}
`,
productHero: `
_type == 'productHero' => {
_type,
_key,
}
`,
collectionGrid: `
_type == 'collectionGrid' => {
_type,
_key,
"title": ^.title,
"paginationLimit": *[_type == "shopSettings"][0].paginationLimit,
"filter": *[_type == "shopSettings"][0].filter{
isActive,
groups[]{
"id": _key,
title,
"slug": slug.current,
display,
options[]->{
type,
title,
"slug": slug.current,
"color": color->color
}
}
},
"sort": *[_type == "shopSettings"][0].sort{
isActive,
options[]{
"slug": type,
"title": coalesce(title, select(
${sortFallbacks}
))
}
},
"noFilterResults": *[_type == "shopSettings"][0].noFilterResults[]{
${ptContent}
},
}
`,
articleGrid: `
_type == 'articleGrid' => {
_type,
_key,
"title": ^.title,
active,
newsletter,
subscriberHide,
subscriberShow,
freshDotWhack,
featuredDotWhack,
dotWhackMessage,
dotWhackPlacement,
gridDotWhack,
gridDotWhackPlacement,
gridDotWhackMessage,
"colors": {
"headerColor": headerColor->title,
"featuredColor": featuredColor->title,
"gridColor": gridColor->title
},
"articleFilter": *[_type == "articleSettings"][0].articleFilter{
isActive,
groups[]{
"id": _key,
title,
"slug": slug.current,
display,
options[]->{
type,
title,
"slug": slug.current,
"color": color->color
}
}
},
"articlePaginationLimit": *[_type == "articleSettings"][0].articlePaginationLimit,
"articleSort": *[_type == "articleSettings"][0].articleSort{
isActive,
options[]{
"slug": type,
"title": coalesce(title, select(
${sortFallbacks}
))
}
},
"noFilterResults": *[_type == "shopSettings"][0].noFilterResults[]{
${ptContent}
}
}
`,
articleRelated: `
_type == 'articleRelated' => {
_type,
_key,
content,
"color":color->title,
active,
fromApi,
"headline": *[_type == "siteTaxonomy"][0].relatedHeadline,
"button": *[_type == "siteTaxonomy"][0].readMore,
manualrelatedArticles[wasDeleted != true && isDraft != true]->${article} | order(orderRank)
}
`,
productRelated: `
_type == 'productRelated' => {
_type,
_key,
content,
"color":color->title,
active,
fromApi,
manualrelatedProducts[wasDeleted != true && isDraft != true]->${product} | order(publishDate desc)
}
`,
featuredArticles: `
_type == 'featuredArticles' => {
_type,
"width": itemsInView,
isSlider,
articlesToShow,
"background": background->title,
filterBy,
"headline": *[_type == "siteTaxonomy"][0].relatedHeadline,
"button": *[_type == "siteTaxonomy"][0].readMore,
"articles": *[_type == "article" && wasDeleted != true && isDraft != true]${article} | order(orderRank)[0...10]
}
`,
textBlock: `
_type == 'textBlock' => {
_type,
_key,
subscriberHide,
subscriberShow,
"colorTitle": color->title,
content[]{
${ptContent}
},
textAlign,
maxWidth
}
`,
orders: `
_type == 'orders' => {
_type,
_key
}
`,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment