@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.)
94 lines (92 loc) • 2.37 kB
JavaScript
import { Link } from 'part:@sanity/base/router'
import React from "react"
import { BsFillQuestionCircleFill } from 'react-icons/bs'
import { coalesceLabel } from "../../../helpers"
import { valueSlider } from '../../properties/datatype'
export default {
name: 'ConditionState',
type: 'object',
title: 'Tilstandsstatus',
titleEN: 'Condition state',
fields: [
{
name: 'hasType',
title: 'Klassifisert som',
titleEN: 'Classified as',
type: 'reference',
to: [{ type: 'ConditionType' }],
validation: (Rule) => Rule.required(),
options: {
semanticSanity: {
'@type': '@id'
}
},
},
valueSlider,
{
name: 'attributes',
title: 'Egenskaper',
titleEN: 'Attributes',
description: 'Eksempel på custom felt for spesialistvurderinger',
type: 'array',
of: [{ type: 'string' }],
options: {
list: [
{ title: 'Missing', value: 'missing' },
{ title: 'Partial remains', value: 'partialRemains' },
],
semanticSanity: {
'@container': '@set',
}
},
},
{
name: 'images',
title: 'Dokumentasjonsfotografi',
titleEN: 'Documentation images',
description: (
<span>
Bilder knyttet til rapporten som dokumentere det rapporten omhandler.{' '}
<Link
target="blank"
href={'https://muna.xyz/docs/model/properties#documentation-images'}
>
<BsFillQuestionCircleFill />
</Link>
</span>
),
descriptionEN: (
<span>
Images that documents the subject of the report.{' '}
<Link
target="blank"
href={'https://muna.xyz/docs/model/properties#documentation-images'}
>
<BsFillQuestionCircleFill />
</Link>
</span>
),
type: 'array',
of: [{ type: 'DigitalObjectImage' }],
options: {
layout: 'grid',
semanticSanity: {
'@container': '@set',
'@type': '@id'
}
},
},
],
preview: {
select: {
type: 'hasType.label',
value: 'value',
},
prepare(selection) {
const { type, value } = selection
return {
title: `${coalesceLabel(type)}: ${value} / 100`,
}
},
},
}