Skip to content

Instantly share code, notes, and snippets.

@3200pro
Last active November 29, 2020 22:04
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 3200pro/40333f731b893d1bcaf2da1f231c2c56 to your computer and use it in GitHub Desktop.
Save 3200pro/40333f731b893d1bcaf2da1f231c2c56 to your computer and use it in GitHub Desktop.
Sanity Schema - Shuffled Text - Part 3
export default {
title: 'Shuffled Text',
type: 'object',
name: 'shuffledText',
fields: [
{
title: 'Shuffled Text',
name: 'text',
type: 'array',
of: [
{
title: 'String',
name: 'string',
type: 'string'
}
],
},
{
title: 'Text Style',
name: 'textStyle',
type: 'string',
validation: Rule =>
Rule.error("Please select a style (or none)").required(),
options: {
list: [
{title: 'None', value: 'span'},
{title: 'Strong', value: 'strong'},
{title: 'Italic', value: 'italic'},
{title: 'H1', value: 'h1'},
{title: 'H2', value: 'h2'},
{title: 'H3', value: 'h3'},
{title: 'H4', value: 'h4'},
{title: 'H5', value: 'h5'},
]
}
},
{
title: 'Text Size',
name: 'textSize',
type: 'number',
validation: Rule =>
Rule.error("Please select a style (or none)").required(),
options: {
list: [
{title: 'Standard', value: 1},
{title: 'Large', value: 3},
{title: 'XLarge', value: 5},
{title: 'XXLarge', value: 7} ]
}
}
],
preview: {
select: {
title: 'text',
},
prepare(selection) {
const {title} = selection
return {
title: title.toString(),
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment