import { defineField, defineType } from "sanity"; import { Files } from "lucide-react"; import { orderRankField } from "@sanity/orderable-document-list"; import meta from "../blocks/shared/meta"; export default defineType({ name: "page", type: "document", title: "Page", icon: Files, groups: [ { name: "content", title: "Content", }, { name: "seo", title: "SEO", }, { name: "settings", title: "Settings", }, ], fields: [ defineField({ name: "title", type: "string", group: "content" }), defineField({ name: "slug", title: "Slug", type: "slug", group: "settings", options: { source: "title", maxLength: 96, }, validation: (Rule) => Rule.required(), }), defineField({ name: "blocks", type: "array", group: "content", of: [ { type: "hero-1" }, { type: "hero-2" }, { type: "section-header" }, { type: "split-row" }, { type: "grid-row" }, { type: "carousel-1" }, { type: "carousel-2" }, { type: "timeline-row" }, { type: "cta-1" }, { type: "logo-cloud-1" }, { type: "faqs" }, { type: "form-newsletter" }, { type: "all-posts" }, ], options: { insertMenu: { groups: [ { name: "hero", title: "Hero", of: ["hero-1", "hero-2"], }, { name: "logo-cloud", title: "Logo Cloud", of: ["logo-cloud-1"], }, { name: "section-header", title: "Section Header", of: ["section-header"], }, { name: "grid", title: "Grid", of: ["grid-row"], }, { name: "split", title: "Split", of: ["split-row"], }, { name: "carousel", title: "Carousel", of: ["carousel-1", "carousel-2"], }, { name: "timeline", title: "Timeline", of: ["timeline-row"], }, { name: "cta", title: "CTA", of: ["cta-1"], }, { name: "faqs", title: "FAQs", of: ["faqs"], }, { name: "forms", title: "Forms", of: ["form-newsletter"], }, { name: "all-posts", title: "All Posts", of: ["all-posts"], }, ], views: [ { name: "grid", previewImageUrl: (block) => `/static/images/preview/${block}.jpg`, }, { name: "list" }, ], }, }, }), meta, orderRankField({ type: "page" }), ], });