jackmerrill.com/sanity/schemas/author.ts

58 lines
1017 B
TypeScript
Raw Permalink Normal View History

2023-05-29 23:28:07 -07:00
import { defineField, defineType } from "sanity";
2023-05-24 21:49:48 -07:00
export default defineType({
2023-05-29 23:28:07 -07:00
name: "author",
title: "Author",
type: "document",
2023-05-24 21:49:48 -07:00
fields: [
defineField({
2023-05-29 23:28:07 -07:00
name: "name",
title: "Name",
type: "string",
2023-05-24 21:49:48 -07:00
}),
defineField({
2023-05-29 23:28:07 -07:00
name: "slug",
title: "Slug",
type: "slug",
2023-05-24 21:49:48 -07:00
options: {
2023-05-29 23:28:07 -07:00
source: "name",
2023-05-24 21:49:48 -07:00
maxLength: 96,
},
}),
defineField({
2023-05-29 23:28:07 -07:00
name: "image",
title: "Image",
type: "image",
2023-05-24 21:49:48 -07:00
options: {
hotspot: true,
},
fields: [
{
2023-05-29 23:28:07 -07:00
name: "alt",
type: "string",
title: "Alternative Text",
},
],
2023-05-24 21:49:48 -07:00
}),
defineField({
2023-05-29 23:28:07 -07:00
name: "bio",
title: "Bio",
type: "array",
2023-05-24 21:49:48 -07:00
of: [
{
2023-05-29 23:28:07 -07:00
title: "Block",
type: "block",
styles: [{ title: "Normal", value: "normal" }],
2023-05-24 21:49:48 -07:00
lists: [],
},
],
}),
],
preview: {
select: {
2023-05-29 23:28:07 -07:00
title: "name",
media: "image",
2023-05-24 21:49:48 -07:00
},
},
2023-05-29 23:28:07 -07:00
});