52 lines
2.6 KiB
TypeScript
52 lines
2.6 KiB
TypeScript
import { defineField, defineType } from "sanity";
|
|
|
|
export const project = defineType({
|
|
name: "project",
|
|
title: "Project",
|
|
type: "document",
|
|
fields: [
|
|
defineField({ name: "title", title: "عنوان", type: "string", validation: (r) => r.required() }),
|
|
defineField({ name: "slug", title: "Slug", type: "slug", options: { source: "title" }, validation: (r) => r.required() }),
|
|
defineField({ name: "locale", title: "زبان", type: "string", options: { list: [{ value: "fa", title: "فارسی" }, { value: "en", title: "English" }] }, initialValue: "fa" }),
|
|
defineField({
|
|
name: "projectType",
|
|
title: "نوع پروژه",
|
|
type: "string",
|
|
options: {
|
|
list: [
|
|
{ value: "product", title: "محصول" },
|
|
{ value: "brand-system", title: "سیستم برند" },
|
|
{ value: "open-source", title: "متنباز" },
|
|
{ value: "creative-work", title: "اثر خلاقانه" },
|
|
],
|
|
},
|
|
validation: (r) => r.required(),
|
|
}),
|
|
defineField({ name: "description", title: "توضیح کوتاه", type: "text", rows: 2 }),
|
|
defineField({ name: "coverImage", title: "تصویر کاور", type: "image", options: { hotspot: true }, fields: [defineField({ name: "alt", type: "string", title: "Alt text" })] }),
|
|
defineField({ name: "gallery", title: "گالری", type: "array", of: [{ type: "image", options: { hotspot: true }, fields: [defineField({ name: "alt", type: "string", title: "Alt text" })] }] }),
|
|
defineField({
|
|
name: "body",
|
|
title: "محتوا",
|
|
type: "array",
|
|
of: [{ type: "block" }, { type: "image", options: { hotspot: true } }],
|
|
}),
|
|
defineField({ name: "techStack", title: "تکنولوژیها", type: "array", of: [{ type: "string" }] }),
|
|
defineField({ name: "toolsUsed", title: "ابزارها", type: "array", of: [{ type: "string" }] }),
|
|
defineField({ name: "liveUrl", title: "لینک زنده", type: "url" }),
|
|
defineField({ name: "githubUrl", title: "GitHub", type: "url" }),
|
|
defineField({ name: "featured", title: "برگزیده", type: "boolean", initialValue: false }),
|
|
defineField({
|
|
name: "seo",
|
|
title: "SEO",
|
|
type: "object",
|
|
fields: [
|
|
defineField({ name: "title", type: "string", title: "عنوان SEO" }),
|
|
defineField({ name: "description", type: "text", title: "توضیحات", rows: 2 }),
|
|
defineField({ name: "ogImage", type: "image", title: "تصویر OG" }),
|
|
],
|
|
}),
|
|
],
|
|
preview: { select: { title: "title", subtitle: "projectType", media: "coverImage" } },
|
|
});
|