@seidhr/sanity-plugin-muna-schemas
Version:
Muna or ᛗᚢᚾᚨ means remember in norse. Muna is a schema for the Sanity Studio that enables detailed descriptions of cultural heritage objects and knowledge about their contexts as well as pages about them (or anything else really.)
47 lines (45 loc) • 1.02 kB
JavaScript
import { coalesceLabel, defaultFieldsets } from '../../../../'
import { referredToBy, timespanSingleton } from '../../../../../lib/schemas/properties/object'
export default {
name: 'Identifier',
type: 'object',
title: 'Identifikator',
titleEN: 'Identifier',
fieldsets: defaultFieldsets,
fields: [
{
name: 'content',
title: 'Identifikator',
titleEN: 'Identifier',
type: 'string',
},
{
name: 'hasType',
title: 'Klassifisert som',
titleEN: 'Classified as',
type: 'reference',
to: [{ type: 'IdentifierType' }],
validation: (Rule) => Rule.required(),
options: {
semanticSanity: {
'@type': '@id'
}
},
},
timespanSingleton,
referredToBy,
],
preview: {
select: {
title: 'content',
type: 'hasType.label',
},
prepare(selection) {
const { title, type } = selection
return {
title: title,
subtitle: coalesceLabel(type),
}
},
},
}