Last active
November 29, 2020 22:04
-
-
Save 3200pro/40333f731b893d1bcaf2da1f231c2c56 to your computer and use it in GitHub Desktop.
Sanity Schema - Shuffled Text - Part 3
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
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