55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import {BookIcon} from '@sanity/icons'
|
|
import {defineType} from 'sanity'
|
|
|
|
const libraryItem = defineType({
|
|
name: 'libraryItem',
|
|
title: 'Library items',
|
|
type: 'document',
|
|
icon: BookIcon,
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
title: 'Title',
|
|
type: 'string',
|
|
validation: (r) => r.required(),
|
|
description:
|
|
'The title of the item. It might be the title of the book, article, podcast episode, etc.',
|
|
},
|
|
{
|
|
name: 'checkedOut',
|
|
title: 'Checked out',
|
|
type: 'boolean',
|
|
validation: (r) => r.required(),
|
|
initialValue: false,
|
|
description: 'If you have already read, listened, etc. to this item.',
|
|
},
|
|
{
|
|
name: 'link',
|
|
title: 'Link',
|
|
type: 'url',
|
|
validation: (r) => r.required(),
|
|
description:
|
|
'You have to provide some link to this content. A link to buy the book, listen to the episode, etc.',
|
|
},
|
|
{
|
|
name: 'description',
|
|
title: 'Description',
|
|
type: 'text',
|
|
description:
|
|
'If you wanna give the readers a short description of why this item is good or worth checking out, this is that.',
|
|
},
|
|
{
|
|
name: 'language',
|
|
hidden: true,
|
|
type: 'string',
|
|
},
|
|
],
|
|
preview: {
|
|
select: {
|
|
title: 'title',
|
|
},
|
|
},
|
|
})
|
|
|
|
export default libraryItem
|