import { defineField, defineType } from "sanity"; import { orderRankField } from "@sanity/orderable-document-list"; export default defineType({ name: "author", title: "Author", type: "document", fields: [ defineField({ name: "name", title: "Name", type: "string", validation: (Rule) => Rule.required(), }), defineField({ name: "slug", title: "Slug", type: "slug", options: { source: "name", maxLength: 96, }, validation: (Rule) => Rule.required(), }), defineField({ name: "image", title: "Image", type: "image", fields: [ { name: "alt", type: "string", title: "Alternative Text", }, ], }), defineField({ name: "role", title: "Professional Role / Title", type: "string", description: "e.g. 'Founder & Senior Destination Wedding Consultant'", initialValue: "Founder & Senior Destination Wedding Consultant", }), defineField({ name: "bio", title: "Author Bio", type: "text", rows: 4, }), defineField({ name: "socialLinks", title: "Social & Portfolio Links", type: "array", of: [ { type: "object", fields: [ defineField({ name: "platform", title: "Platform", type: "string", options: { list: [ { title: "Website / Portfolio", value: "website" }, { title: "LinkedIn", value: "linkedin" }, { title: "Instagram", value: "instagram" }, { title: "WhatsApp", value: "whatsapp" }, ], }, }), defineField({ name: "url", title: "URL", type: "url", }), ], preview: { select: { title: "platform", subtitle: "url", }, }, }, ], }), orderRankField({ type: "author" }), ], preview: { select: { title: "name", media: "image", }, }, });