v0.1.0 commit
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import {defineField, defineType} from 'sanity'
|
||||
|
||||
export default defineType({
|
||||
name: 'roadmapItem',
|
||||
title: 'Roadmap Item',
|
||||
type: 'document',
|
||||
fields: [
|
||||
defineField({
|
||||
name: 'title',
|
||||
title: 'Title',
|
||||
type: 'string',
|
||||
validation: (Rule) => Rule.required().max(100),
|
||||
}),
|
||||
defineField({
|
||||
name: 'description',
|
||||
title: 'Description',
|
||||
type: 'text',
|
||||
rows: 2,
|
||||
description: 'Short description shown on the roadmap card.',
|
||||
validation: (Rule) => Rule.max(300),
|
||||
}),
|
||||
defineField({
|
||||
name: 'status',
|
||||
title: 'Status',
|
||||
type: 'string',
|
||||
options: {
|
||||
list: [
|
||||
{title: 'Planned', value: 'planned'},
|
||||
{title: 'In Progress', value: 'in-progress'},
|
||||
{title: 'Shipped', value: 'shipped'},
|
||||
],
|
||||
layout: 'radio',
|
||||
},
|
||||
initialValue: 'planned',
|
||||
validation: (Rule) => Rule.required(),
|
||||
}),
|
||||
defineField({
|
||||
name: 'order',
|
||||
title: 'Sort Order',
|
||||
type: 'number',
|
||||
description: 'Lower numbers appear first within each status group.',
|
||||
initialValue: 100,
|
||||
}),
|
||||
],
|
||||
orderings: [
|
||||
{
|
||||
title: 'Sort Order',
|
||||
name: 'orderAsc',
|
||||
by: [{field: 'order', direction: 'asc'}],
|
||||
},
|
||||
],
|
||||
preview: {
|
||||
select: {
|
||||
title: 'title',
|
||||
status: 'status',
|
||||
},
|
||||
prepare({title, status}) {
|
||||
const badge =
|
||||
status === 'in-progress' ? '🔄' : status === 'shipped' ? '✅' : '📋'
|
||||
return {
|
||||
title,
|
||||
subtitle: `${badge} ${status ?? 'planned'}`,
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user