import * as demo from 'lib/demo.data' import { TiSpannerOutline } from 'react-icons/ti' import { defineArrayMember, defineField, defineType } from 'sanity' import OpenGraphInput from './OpenGraphInput' export default defineType({ name: 'settings', title: 'Settings', type: 'document', icon: TiSpannerOutline, preview: { select: { title: 'title', subtitle: 'description' } }, // Uncomment below to have edits publish automatically as you type // liveEdit: true, fields: [ defineField({ name: 'title', description: 'This field is the title of your web.', title: 'Title', type: 'string', initialValue: demo.title, validation: (rule) => rule.required(), }), defineField({ name: 'description', description: 'Used both for the description tag for SEO, and the subheader.', title: 'Descriprion', type: 'array', initialValue: demo.description, of: [ defineArrayMember({ type: 'block', options: {}, styles: [], lists: [], marks: { decorators: [], annotations: [ defineField({ type: 'object', name: 'link', fields: [ { type: 'string', name: 'href', title: 'URL', validation: (rule) => rule.required(), }, ], }), ], }, }), ], validation: (rule) => rule.max(155).required(), }), defineField({ name: 'ogImage', title: 'Open Graph Image', description: 'Used for social media previews when linking to the index page.', type: 'object', components: { input: OpenGraphInput as any, }, fields: [ defineField({ name: 'title', title: 'Title', type: 'string', initialValue: demo.ogImageTitle, }), ], }), ], })