Gwk-Cultural-Park/schemas/contentPage/content.ts

77 lines
1.6 KiB
TypeScript
Raw Permalink Normal View History

2024-09-07 01:40:25 +00:00
// import { BookIcon } from '@sanity/icons'
import { format, parseISO } from 'date-fns'
import { TiCalendarOutline } from 'react-icons/ti'
import {
IoChatbubblesOutline,
IoDocumentOutline,
IoHomeOutline,
IoMapOutline,
IoFolderOutline,
IoOptions,
IoImages,
IoCameraOutline,
} from 'react-icons/io5'
import { defineField, defineType } from 'sanity'
import authorType from '../author'
export default defineType({
name: 'contentpages',
title: 'Content Pages (maintenance)',
icon: IoDocumentOutline,
type: 'document',
fields: [
defineField({
name: 'title',
title: 'Title',
type: 'string',
validation: (rule) => rule.required(),
}),
defineField({
name: 'subtitle',
title: 'Sub Title',
type: 'string',
}),
defineField({
name: 'coverImage',
title: 'Cover Image',
type: 'array',
of: [
{
name: 'image',
type: 'image',
title: 'Image',
options: {
hotspot: true,
},
fields: [
{
name: 'alt',
type: 'string',
title: 'Alternative text',
},
],
},
],
}),
defineField({
name: 'content',
title: 'Content',
type: 'array',
of: [{ type: 'block' }],
}),
defineField({
name: 'date',
title: 'Date',
type: 'datetime',
initialValue: () => new Date().toISOString(),
}),
defineField({
name: 'author',
title: 'Author',
type: 'reference',
to: [{ type: authorType.name }],
}),
],
})