personal-website/studio/schemas/libraryItem.ts
Filipe Medeiros 098e00e5e0
feat: first i18n
Signed-off-by: Filipe Medeiros <hello@filipesm.eu>
2023-12-03 12:26:05 +01:00

65 lines
1.5 KiB
TypeScript

import {BookIcon} from '@sanity/icons'
import {defineType} from 'sanity'
const libraryItem = defineType({
name: 'libraryItem',
title: 'Library items',
type: 'document',
icon: BookIcon,
initialValue: {
__i18n_lang: 'pt_PT',
},
i18n: {
base: 'pt_PT',
languages: [
{id: 'pt_PT', title: 'Português'},
{id: 'en_EN', title: 'English'},
],
fieldNames: {
lang: '__i18n_lang',
references: '__i18n_refs',
baseReference: '__i18n_base',
},
},
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: 'string',
description:
'If you wanna give the readers a short description of why this item is good or worth checking out, this is that.',
},
],
preview: {
select: {
title: 'title',
},
},
})
export default libraryItem