Adds homePage singleton document type (hero headline/mission, video section, CTA cards, sponsors). Home page fetches from Sanity when configured and falls back to the existing hardcoded values when not. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
83 lines
2.4 KiB
TypeScript
83 lines
2.4 KiB
TypeScript
import { defineType, defineField, defineArrayMember } from 'sanity';
|
|
|
|
export const homePageType = defineType({
|
|
name: 'homePage',
|
|
title: 'Home Page',
|
|
type: 'document',
|
|
// Singleton — only one document of this type should exist
|
|
__experimental_actions: ['update', 'publish', 'unpublish'],
|
|
fields: [
|
|
defineField({
|
|
name: 'heroHeadline',
|
|
title: 'Hero headline',
|
|
type: 'string',
|
|
}),
|
|
defineField({
|
|
name: 'heroMission',
|
|
title: 'Mission statement (hero blockquote)',
|
|
type: 'text',
|
|
rows: 3,
|
|
}),
|
|
defineField({
|
|
name: 'videoHeading',
|
|
title: 'Video section heading',
|
|
type: 'string',
|
|
}),
|
|
defineField({
|
|
name: 'videoBody',
|
|
title: 'Video section body text',
|
|
type: 'text',
|
|
rows: 3,
|
|
}),
|
|
defineField({
|
|
name: 'videoYoutubeId',
|
|
title: 'YouTube video ID',
|
|
type: 'string',
|
|
description: 'Just the ID, e.g. IX2DGd6m8BU — not the full URL',
|
|
}),
|
|
defineField({
|
|
name: 'ctaCards',
|
|
title: 'CTA cards (editorial panel)',
|
|
type: 'array',
|
|
of: [
|
|
defineArrayMember({
|
|
type: 'object',
|
|
name: 'ctaCard',
|
|
fields: [
|
|
defineField({ name: 'label', title: 'Eyebrow label', type: 'string' }),
|
|
defineField({ name: 'title', title: 'Card title', type: 'string' }),
|
|
defineField({ name: 'description', title: 'Description', type: 'text', rows: 2 }),
|
|
defineField({ name: 'image', title: 'Background image', type: 'image', options: { hotspot: true } }),
|
|
defineField({ name: 'href', title: 'Link path', type: 'string' }),
|
|
],
|
|
preview: { select: { title: 'title', subtitle: 'label' } },
|
|
}),
|
|
],
|
|
}),
|
|
defineField({
|
|
name: 'sponsorHeading',
|
|
title: 'Sponsors section heading',
|
|
type: 'string',
|
|
}),
|
|
defineField({
|
|
name: 'sponsors',
|
|
title: 'Sponsors',
|
|
type: 'array',
|
|
of: [
|
|
defineArrayMember({
|
|
type: 'object',
|
|
name: 'sponsor',
|
|
fields: [
|
|
defineField({ name: 'name', title: 'Name', type: 'string' }),
|
|
defineField({ name: 'logo', title: 'Logo', type: 'image' }),
|
|
defineField({ name: 'url', title: 'Website URL', type: 'url' }),
|
|
],
|
|
preview: { select: { title: 'name' } },
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
preview: {
|
|
prepare: () => ({ title: 'Home Page' }),
|
|
},
|
|
});
|