@sinnstack/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/README.md +6 -4
- package/docs/blocks.md +373 -364
- package/docs/data.md +128 -128
- package/docs/finishes.md +165 -0
- package/docs/primitives.md +4 -4
- package/docs/seo.md +191 -187
- package/package.json +15 -24
- package/src/blocks/BlockRenderer.astro +13 -7
- package/src/blocks/CTABanner.astro +8 -8
- package/src/blocks/CTAPair.astro +9 -9
- package/src/blocks/CardGrid.astro +7 -7
- package/src/blocks/ConsentEmbed.astro +1 -1
- package/src/blocks/ConsentManager.astro +1 -1
- package/src/blocks/ContactCard.astro +14 -14
- package/src/blocks/ContactForm.astro +4 -4
- package/src/blocks/ErrorPage.astro +1 -1
- package/src/blocks/FAQ.astro +9 -9
- package/src/blocks/FeatureGrid.astro +7 -7
- package/src/blocks/Hero.astro +11 -11
- package/src/blocks/HeroCarousel.astro +11 -11
- package/src/blocks/HighlightCards.astro +10 -10
- package/src/blocks/LocationHours.astro +14 -14
- package/src/blocks/LogoCloud.astro +7 -7
- package/src/blocks/MaintenancePage.astro +8 -3
- package/src/blocks/MediaText.astro +12 -12
- package/src/blocks/PageHeader.astro +9 -9
- package/src/blocks/ProseSection.astro +8 -8
- package/src/blocks/Reviews.astro +11 -11
- package/src/blocks/RichText.astro +58 -57
- package/src/blocks/StatsBand.astro +117 -117
- package/src/blocks/Steps.astro +9 -9
- package/src/blocks/Testimonials.astro +13 -13
- package/src/blocks/cms/card-grid.ts +48 -80
- package/src/blocks/cms/consent.ts +1 -30
- package/src/blocks/cms/contact-card.ts +4 -46
- package/src/blocks/cms/contact-form.ts +2 -20
- package/src/blocks/cms/cta-banner.ts +2 -23
- package/src/blocks/cms/cta-pair.ts +4 -37
- package/src/blocks/cms/data-base.ts +2 -4
- package/src/blocks/cms/data.ts +19 -19
- package/src/blocks/cms/faq.ts +4 -36
- package/src/blocks/cms/feature-grid.ts +47 -80
- package/src/blocks/cms/fixtures.ts +591 -599
- package/src/blocks/cms/hero-carousel.ts +4 -48
- package/src/blocks/cms/hero.ts +2 -46
- package/src/blocks/cms/highlight-cards.ts +4 -39
- package/src/blocks/cms/images.ts +1 -2
- package/src/blocks/cms/index.ts +59 -87
- package/src/blocks/cms/location-hours.ts +3 -85
- package/src/blocks/cms/logo-cloud.ts +36 -62
- package/src/blocks/cms/media-text.ts +2 -20
- package/src/blocks/cms/page-header.ts +27 -49
- package/src/blocks/cms/pages.ts +35 -81
- package/src/blocks/cms/prose-section.ts +2 -22
- package/src/blocks/cms/reviews.ts +5 -56
- package/src/blocks/cms/schema-dsl.ts +134 -0
- package/src/blocks/cms/schema.ts +794 -0
- package/src/blocks/cms/shared.ts +63 -115
- package/src/blocks/cms/stats-band.ts +35 -61
- package/src/blocks/cms/steps.ts +4 -31
- package/src/blocks/cms/testimonials.ts +4 -38
- package/src/blocks/cms/topbar.ts +4 -41
- package/src/blocks/cms/types.ts +1 -37
- package/src/blocks/consent.ts +2 -2
- package/src/blocks/index.ts +2 -2
- package/src/blocks/internal/Actions.astro +11 -5
- package/src/blocks/internal/BlockHeader.astro +7 -7
- package/src/blocks/internal/Placeholder.astro +3 -3
- package/src/blocks/internal/fields.ts +18 -0
- package/src/blocks/internal/registry-contract.ts +67 -0
- package/src/blocks/internal/util.ts +4 -4
- package/src/blocks/lib/contact.ts +10 -4
- package/src/blocks/lib/faq.ts +1 -1
- package/src/blocks/lib/markdown.ts +350 -0
- package/src/blocks/lib/rich-text.ts +132 -143
- package/src/blocks/scripts/consent-manager.ts +1 -1
- package/src/blocks/scripts/consent-store.ts +1 -1
- package/src/blocks/scripts/hours.ts +3 -2
- package/src/blocks/types.ts +33 -23
- package/src/data/ChartContainer.astro +2 -1
- package/src/data/cms.ts +130 -190
- package/src/data/lib/chart.ts +13 -4
- package/src/data/schema.ts +65 -0
- package/src/finishes/aurora.css +75 -0
- package/src/finishes/autumn.css +87 -0
- package/src/finishes/blueprint.css +69 -0
- package/src/finishes/brutalist.css +55 -0
- package/src/finishes/clay.css +48 -0
- package/src/finishes/day-cycle.css +46 -0
- package/src/finishes/fog.css +71 -0
- package/src/finishes/glass.css +149 -0
- package/src/finishes/holographic.css +91 -0
- package/src/finishes/night.css +77 -0
- package/src/finishes/paper.css +58 -0
- package/src/finishes/polished-glass.css +159 -0
- package/src/finishes/rain.css +84 -0
- package/src/finishes/scripts/day-cycle.ts +30 -0
- package/src/finishes/scripts/holographic.ts +37 -0
- package/src/finishes/scripts/spotlight.ts +30 -0
- package/src/finishes/spotlight.css +41 -0
- package/src/finishes/spring.css +80 -0
- package/src/finishes/terminal.css +49 -0
- package/src/primitives/Divider.astro +1 -1
- package/src/primitives/FocusRing.astro +1 -1
- package/src/primitives/FormField.astro +2 -2
- package/src/primitives/Image.astro +3 -3
- package/src/primitives/Input.astro +4 -2
- package/src/primitives/MetricCard.astro +3 -1
- package/src/primitives/Picture.astro +3 -3
- package/src/primitives/Prose.astro +1 -1
- package/src/primitives/Select.astro +4 -2
- package/src/primitives/Slider.astro +1 -1
- package/src/primitives/Table.astro +1 -1
- package/src/primitives/Textarea.astro +4 -2
- package/src/primitives/Thumbnail.astro +2 -2
- package/src/primitives/index.ts +4 -4
- package/src/primitives/internal/ChoiceField.astro +4 -2
- package/src/primitives/scripts/slider.ts +1 -1
- package/src/primitives/scripts/table-sort.ts +2 -2
- package/src/seo/cms.ts +59 -80
- package/src/seo/index.ts +1 -1
- package/src/seo/integration.ts +40 -3
- package/src/seo/lib/jsonld.ts +10 -2
- package/src/seo/lib/meta.ts +2 -2
- package/src/seo/lib/redirects.ts +14 -4
- package/src/seo/lib/rss.ts +1 -1
- package/src/seo/lib/sitemap.ts +1 -1
- package/src/seo/schema.ts +43 -0
- package/src/blocks/internal/tina.ts +0 -19
- /package/src/blocks/{lib → internal}/consent.ts +0 -0
- /package/src/blocks/{lib → internal}/reviews.ts +0 -0
- /package/src/blocks/{lib → internal}/slug.ts +0 -0
- /package/src/data/{lib → internal}/scale.ts +0 -0
- /package/src/primitives/{lib → internal}/image-plan.ts +0 -0
- /package/src/primitives/{lib → internal}/image.ts +0 -0
- /package/src/primitives/{lib → internal}/slider.ts +0 -0
- /package/src/seo/{lib → internal}/url.ts +0 -0
|
@@ -0,0 +1,794 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ready-made SinnStackCMS schemas for every block, plus the site settings the blocks read (topbar,
|
|
3
|
+
* consent banner, error pages). Plain data in the CMS's field format, checked against the stored
|
|
4
|
+
* data shapes (see schema-dsl.ts), so what editors save is what the mappers read.
|
|
5
|
+
*
|
|
6
|
+
* import { blockSchemas, siteSettingsFields } from '@sinnstack/ui/blocks/schema';
|
|
7
|
+
*
|
|
8
|
+
* fields.blocks({ label: 'Sections', types: blockSchemas })
|
|
9
|
+
* fields.blocks({ types: { hero: blockSchemas.hero, faq: blockSchemas.faq } }) // a subset
|
|
10
|
+
*
|
|
11
|
+
* `withoutFields(blockSchemas.hero, ['scrim', 'minHeight'])` hides fields editors shouldn't change;
|
|
12
|
+
* spread a schema to relabel or add fields. Site-only blocks sit alongside them in `types`.
|
|
13
|
+
*/
|
|
14
|
+
import { blockIconNames } from '../icons';
|
|
15
|
+
import type {
|
|
16
|
+
CardGridData,
|
|
17
|
+
CmsAction,
|
|
18
|
+
CmsSettings,
|
|
19
|
+
ConsentData,
|
|
20
|
+
ContactCardData,
|
|
21
|
+
ContactFormData,
|
|
22
|
+
CtaBannerData,
|
|
23
|
+
CtaPairData,
|
|
24
|
+
FaqData,
|
|
25
|
+
FeatureGridData,
|
|
26
|
+
HeroCarouselData,
|
|
27
|
+
HeroData,
|
|
28
|
+
HighlightCardsData,
|
|
29
|
+
LocationHoursData,
|
|
30
|
+
LogoCloudData,
|
|
31
|
+
MediaTextData,
|
|
32
|
+
PageHeaderData,
|
|
33
|
+
ProseSectionData,
|
|
34
|
+
ReviewsData,
|
|
35
|
+
StatsBandData,
|
|
36
|
+
StepsData,
|
|
37
|
+
TestimonialsData,
|
|
38
|
+
TopbarData,
|
|
39
|
+
} from './data';
|
|
40
|
+
import type { ErrorPagesSettings } from './pages';
|
|
41
|
+
import { blockSchema, objectSchema, type BlockSchema, type FieldFor, type ObjectField, type SelectOption } from './schema-dsl';
|
|
42
|
+
|
|
43
|
+
export * from './schema-dsl';
|
|
44
|
+
|
|
45
|
+
// --- Shared fields ---------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
type SettingKey = keyof CmsSettings;
|
|
48
|
+
|
|
49
|
+
/** Section settings (`settings` on every block). Pass keys to offer only those. */
|
|
50
|
+
export function settingsField(keys: SettingKey[] = ['anchor', 'background', 'tone', 'spacing', 'align']): FieldFor<CmsSettings> {
|
|
51
|
+
const all = {
|
|
52
|
+
anchor: {
|
|
53
|
+
type: 'text',
|
|
54
|
+
label: 'Anchor',
|
|
55
|
+
help: 'Lets you link straight to this section: /page#anchor. Lowercase letters, numbers and dashes.',
|
|
56
|
+
pattern: '[a-z0-9-]+',
|
|
57
|
+
patternMessage: 'Use lowercase letters, numbers and dashes.',
|
|
58
|
+
},
|
|
59
|
+
background: {
|
|
60
|
+
type: 'select',
|
|
61
|
+
label: 'Background',
|
|
62
|
+
options: [
|
|
63
|
+
{ value: 'none', label: 'None' },
|
|
64
|
+
{ value: 'subtle', label: 'Subtle' },
|
|
65
|
+
{ value: 'sunken', label: 'Sunken' },
|
|
66
|
+
{ value: 'tinted', label: 'Tinted' },
|
|
67
|
+
{ value: 'strong', label: 'Strong (brand color)' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
tone: { type: 'select', label: 'Color', options: [{ value: 'accent', label: 'Brand' }, { value: 'neutral', label: 'Neutral' }] },
|
|
71
|
+
spacing: { type: 'select', label: 'Spacing', options: [{ value: 's', label: 'Small' }, { value: 'm', label: 'Medium' }, { value: 'l', label: 'Large' }, { value: 'xl', label: 'Extra large' }] },
|
|
72
|
+
align: { type: 'select', label: 'Alignment', options: [{ value: 'start', label: 'Left' }, { value: 'center', label: 'Centered' }] },
|
|
73
|
+
} satisfies NonNullable<FieldFor<CmsSettings>['fields']>;
|
|
74
|
+
return { type: 'object', label: 'Section settings', fields: Object.fromEntries(keys.map((k) => [k, all[k]])) as typeof all };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** A list of buttons (`actions`). */
|
|
78
|
+
export function actionsField(max = 2, label = 'Buttons'): FieldFor<CmsAction[]> {
|
|
79
|
+
return {
|
|
80
|
+
type: 'list',
|
|
81
|
+
label,
|
|
82
|
+
max,
|
|
83
|
+
itemLabel: 'label',
|
|
84
|
+
of: {
|
|
85
|
+
type: 'object',
|
|
86
|
+
fields: {
|
|
87
|
+
label: { type: 'text', label: 'Label', required: true },
|
|
88
|
+
href: { type: 'link', label: 'Link', required: true, help: 'A page path (/contact), a full URL, tel: or mailto:.' },
|
|
89
|
+
style: {
|
|
90
|
+
type: 'select',
|
|
91
|
+
label: 'Style',
|
|
92
|
+
help: 'Leave empty: the first button is solid, the rest outlined.',
|
|
93
|
+
options: [{ value: 'solid', label: 'Solid' }, { value: 'outline', label: 'Outline' }, { value: 'ghost', label: 'Text only' }],
|
|
94
|
+
},
|
|
95
|
+
arrow: { type: 'boolean', label: 'Show an arrow' },
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const iconOptions: SelectOption[] = blockIconNames.map((n) => n);
|
|
102
|
+
const iconField = { type: 'select', label: 'Icon', options: iconOptions } as const;
|
|
103
|
+
|
|
104
|
+
const eyebrow = { type: 'text', label: 'Eyebrow', help: 'A short label above the heading.' } as const;
|
|
105
|
+
const heading = { type: 'text', label: 'Heading' } as const;
|
|
106
|
+
const intro = { type: 'textarea', label: 'Intro', rows: 3 } as const;
|
|
107
|
+
const image = { type: 'image', label: 'Image', help: 'Keep images under src/ so they can be optimized.' } as const;
|
|
108
|
+
const imageAlt = { type: 'text', label: 'Image description (alt text)', help: 'Describe the image for people who can’t see it. Leave empty if it’s decoration.' } as const;
|
|
109
|
+
const richText = { type: 'markdown', rows: 8, help: 'Markdown: **bold**, *italic*, [link](/page), - lists, ## headings. Leave a blank line between paragraphs.' } as const;
|
|
110
|
+
const mediaPosition: FieldFor<HeroData['mediaPosition']> = { type: 'select', label: 'Image side', options: [{ value: 'start', label: 'Left' }, { value: 'end', label: 'Right' }] };
|
|
111
|
+
const scrim: FieldFor<HeroData['scrim']> = { type: 'select', label: 'Text backdrop', help: 'How the image is darkened behind the text.', options: [{ value: 'even', label: 'Even' }, { value: 'gradient', label: 'Gradient' }] };
|
|
112
|
+
const tone: FieldFor<CtaBannerData['tone']> = { type: 'select', label: 'Color', options: [{ value: 'accent', label: 'Brand' }, { value: 'neutral', label: 'Neutral' }] };
|
|
113
|
+
const sizes = [{ value: 's', label: 'Small' }, { value: 'm', label: 'Medium' }, { value: 'l', label: 'Large' }] as Array<{ value: 's' | 'm' | 'l'; label: string }>;
|
|
114
|
+
const columns = <const V extends string>(values: V[]) => ({ type: 'select' as const, label: 'Columns', options: values });
|
|
115
|
+
const contactTypes = [
|
|
116
|
+
{ value: 'address', label: 'Address' },
|
|
117
|
+
{ value: 'phone', label: 'Phone' },
|
|
118
|
+
{ value: 'fax', label: 'Fax' },
|
|
119
|
+
{ value: 'email', label: 'Email' },
|
|
120
|
+
{ value: 'hours', label: 'Hours' },
|
|
121
|
+
{ value: 'link', label: 'Link' },
|
|
122
|
+
] as Array<{ value: 'address' | 'phone' | 'fax' | 'email' | 'hours' | 'link'; label: string }>;
|
|
123
|
+
const rating = { type: 'number', label: 'Rating', help: '1 to 5 stars.', min: 1, max: 5, step: 0.5 } as const;
|
|
124
|
+
const isoDate = { type: 'text', pattern: '\\d{4}-\\d{2}-\\d{2}', patternMessage: 'Use the format YYYY-MM-DD.', placeholder: 'YYYY-MM-DD' } as const;
|
|
125
|
+
const time = { type: 'text', pattern: '([01]\\d|2[0-3]):[0-5]\\d', patternMessage: 'Use 24-hour time, e.g. 09:00 or 17:30.', placeholder: 'HH:MM' } as const;
|
|
126
|
+
|
|
127
|
+
// --- Blocks ------------------------------------------------------------------------------------
|
|
128
|
+
|
|
129
|
+
export const heroSchema = blockSchema<HeroData>({
|
|
130
|
+
label: 'Hero',
|
|
131
|
+
itemLabel: 'heading',
|
|
132
|
+
fields: {
|
|
133
|
+
variant: {
|
|
134
|
+
type: 'select',
|
|
135
|
+
label: 'Layout',
|
|
136
|
+
options: [
|
|
137
|
+
{ value: 'text', label: 'Text only' },
|
|
138
|
+
{ value: 'split', label: 'Text and image side by side' },
|
|
139
|
+
{ value: 'media', label: 'Text over a background image' },
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
eyebrow,
|
|
143
|
+
heading: { type: 'text', label: 'Headline', required: true, max: 90 },
|
|
144
|
+
description: { type: 'textarea', label: 'Supporting text', max: 240 },
|
|
145
|
+
actions: actionsField(2),
|
|
146
|
+
meta: { type: 'text', label: 'Small print', help: 'A short line under the buttons.' },
|
|
147
|
+
image,
|
|
148
|
+
imageAlt,
|
|
149
|
+
mediaPosition,
|
|
150
|
+
scrim,
|
|
151
|
+
minHeight: {
|
|
152
|
+
type: 'select',
|
|
153
|
+
label: 'Height',
|
|
154
|
+
options: [{ value: 'auto', label: 'Fit the content' }, { value: 'm', label: 'Medium' }, { value: 'l', label: 'Large' }, { value: 'screen', label: 'Full screen' }],
|
|
155
|
+
},
|
|
156
|
+
settings: settingsField(),
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export const heroCarouselSchema = blockSchema<HeroCarouselData>({
|
|
161
|
+
label: 'Hero carousel',
|
|
162
|
+
itemLabel: 'label',
|
|
163
|
+
fields: {
|
|
164
|
+
label: { type: 'text', label: 'Name for screen readers', help: 'E.g. “Featured”. Not shown on the page.' },
|
|
165
|
+
slides: {
|
|
166
|
+
type: 'list',
|
|
167
|
+
label: 'Slides',
|
|
168
|
+
itemLabel: 'heading',
|
|
169
|
+
min: 1,
|
|
170
|
+
of: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
fields: {
|
|
173
|
+
eyebrow,
|
|
174
|
+
heading: { type: 'text', label: 'Headline', required: true, max: 90 },
|
|
175
|
+
description: { type: 'textarea', label: 'Supporting text', max: 240 },
|
|
176
|
+
actions: actionsField(2),
|
|
177
|
+
image: { type: 'image', label: 'Background image', help: 'Decorative: it has no alt text.' },
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
autoplay: { type: 'number', label: 'Autoplay (seconds per slide)', help: 'Empty or 0 to turn it off. At least 5.', min: 0, integer: true },
|
|
182
|
+
minHeight: {
|
|
183
|
+
type: 'select',
|
|
184
|
+
label: 'Height',
|
|
185
|
+
options: [{ value: 'banner', label: 'Banner' }, { value: 'm', label: 'Medium' }, { value: 'l', label: 'Large' }, { value: 'screen', label: 'Full screen' }],
|
|
186
|
+
},
|
|
187
|
+
motion: { type: 'select', label: 'Motion', options: [{ value: 'none', label: 'None' }, { value: 'zoom', label: 'Slow zoom' }] },
|
|
188
|
+
controls: { type: 'select', label: 'Controls', options: [{ value: 'bar', label: 'Bar' }, { value: 'split', label: 'Arrows at the sides' }] },
|
|
189
|
+
scrim,
|
|
190
|
+
settings: settingsField(['anchor', 'align']),
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
export const pageHeaderSchema = blockSchema<PageHeaderData>({
|
|
195
|
+
label: 'Page header',
|
|
196
|
+
itemLabel: 'heading',
|
|
197
|
+
fields: {
|
|
198
|
+
eyebrow,
|
|
199
|
+
heading: { type: 'text', label: 'Heading', required: true },
|
|
200
|
+
description: intro,
|
|
201
|
+
breadcrumbs: {
|
|
202
|
+
type: 'list',
|
|
203
|
+
label: 'Breadcrumbs',
|
|
204
|
+
itemLabel: 'label',
|
|
205
|
+
of: { type: 'object', fields: { label: { type: 'text', label: 'Label', required: true }, href: { type: 'link', label: 'Link', help: 'Leave empty on the current page.' } } },
|
|
206
|
+
},
|
|
207
|
+
breadcrumbPosition: { type: 'select', label: 'Breadcrumbs position', options: [{ value: 'above', label: 'Above the heading' }, { value: 'below', label: 'Below the heading' }] },
|
|
208
|
+
actions: actionsField(2),
|
|
209
|
+
settings: settingsField(),
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
export const ctaBannerSchema = blockSchema<CtaBannerData>({
|
|
214
|
+
label: 'Call to action',
|
|
215
|
+
itemLabel: 'heading',
|
|
216
|
+
fields: {
|
|
217
|
+
heading: { type: 'text', label: 'Heading', required: true },
|
|
218
|
+
description: { type: 'textarea', label: 'Supporting text' },
|
|
219
|
+
actions: actionsField(2),
|
|
220
|
+
note: { type: 'text', label: 'Note', help: 'Small print under the buttons.' },
|
|
221
|
+
variant: { type: 'select', label: 'Style', options: [{ value: 'solid', label: 'Solid' }, { value: 'soft', label: 'Soft' }, { value: 'outline', label: 'Outline' }] },
|
|
222
|
+
tone,
|
|
223
|
+
bleed: { type: 'boolean', label: 'Full width' },
|
|
224
|
+
settings: settingsField(['anchor', 'spacing', 'align']),
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
export const ctaPairSchema = blockSchema<CtaPairData>({
|
|
229
|
+
label: 'Two calls to action',
|
|
230
|
+
itemLabel: 'label',
|
|
231
|
+
fields: {
|
|
232
|
+
label: { type: 'text', label: 'Name for screen readers', help: 'Not shown on the page.' },
|
|
233
|
+
items: {
|
|
234
|
+
type: 'list',
|
|
235
|
+
label: 'Panels',
|
|
236
|
+
itemLabel: 'heading',
|
|
237
|
+
max: 2,
|
|
238
|
+
of: {
|
|
239
|
+
type: 'object',
|
|
240
|
+
fields: {
|
|
241
|
+
heading: { type: 'text', label: 'Heading', required: true },
|
|
242
|
+
description: { type: 'textarea', label: 'Supporting text' },
|
|
243
|
+
actions: actionsField(2),
|
|
244
|
+
tone,
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
bleed: { type: 'boolean', label: 'Full width', default: true },
|
|
249
|
+
settings: settingsField(['anchor', 'align']),
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
export const featureGridSchema = blockSchema<FeatureGridData>({
|
|
254
|
+
label: 'Feature grid',
|
|
255
|
+
itemLabel: 'heading',
|
|
256
|
+
fields: {
|
|
257
|
+
eyebrow,
|
|
258
|
+
heading,
|
|
259
|
+
description: intro,
|
|
260
|
+
items: {
|
|
261
|
+
type: 'list',
|
|
262
|
+
label: 'Features',
|
|
263
|
+
itemLabel: 'title',
|
|
264
|
+
of: {
|
|
265
|
+
type: 'object',
|
|
266
|
+
fields: {
|
|
267
|
+
title: { type: 'text', label: 'Title', required: true },
|
|
268
|
+
description: { type: 'textarea', label: 'Description' },
|
|
269
|
+
icon: iconField,
|
|
270
|
+
href: { type: 'link', label: 'Link' },
|
|
271
|
+
badge: { type: 'text', label: 'Badge', help: 'A short tag such as “New”.' },
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
variant: { type: 'select', label: 'Style', options: [{ value: 'plain', label: 'Plain' }, { value: 'card', label: 'Cards' }, { value: 'divided', label: 'Divided' }] },
|
|
276
|
+
layout: { type: 'select', label: 'Icon position', options: [{ value: 'stacked', label: 'Above the text' }, { value: 'inline', label: 'Beside the text' }] },
|
|
277
|
+
columns: columns(['1', '2', '3', '4']),
|
|
278
|
+
size: { type: 'select', label: 'Size', options: sizes },
|
|
279
|
+
settings: settingsField(),
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
export const cardGridSchema = blockSchema<CardGridData>({
|
|
284
|
+
label: 'Card grid',
|
|
285
|
+
itemLabel: 'heading',
|
|
286
|
+
fields: {
|
|
287
|
+
eyebrow,
|
|
288
|
+
heading,
|
|
289
|
+
description: intro,
|
|
290
|
+
items: {
|
|
291
|
+
type: 'list',
|
|
292
|
+
label: 'Cards',
|
|
293
|
+
itemLabel: 'title',
|
|
294
|
+
of: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
fields: {
|
|
297
|
+
title: { type: 'text', label: 'Title', required: true },
|
|
298
|
+
description: { type: 'textarea', label: 'Description' },
|
|
299
|
+
href: { type: 'link', label: 'Link' },
|
|
300
|
+
image,
|
|
301
|
+
imageAlt,
|
|
302
|
+
eyebrow: { type: 'text', label: 'Eyebrow' },
|
|
303
|
+
meta: { type: 'text', label: 'Meta', help: 'Small text such as “4 min read”.' },
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
layout: { type: 'select', label: 'Layout', options: [{ value: 'grid', label: 'Grid' }, { value: 'list', label: 'List' }] },
|
|
308
|
+
featured: { type: 'boolean', label: 'Feature the first card', help: 'Shows the first card larger.' },
|
|
309
|
+
variant: { type: 'select', label: 'Card style', options: [{ value: 'outline', label: 'Outline' }, { value: 'elevated', label: 'Shadow' }, { value: 'filled', label: 'Filled' }] },
|
|
310
|
+
columns: columns(['2', '3', '4']),
|
|
311
|
+
mediaAspect: {
|
|
312
|
+
type: 'select',
|
|
313
|
+
label: 'Image shape',
|
|
314
|
+
options: [{ value: '16/9', label: 'Wide (16:9)' }, { value: '3/2', label: 'Photo (3:2)' }, { value: '4/3', label: 'Classic (4:3)' }, { value: '1/1', label: 'Square' }],
|
|
315
|
+
},
|
|
316
|
+
emptyMessage: { type: 'text', label: 'Message when there are no cards' },
|
|
317
|
+
settings: settingsField(),
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
export const logoCloudSchema = blockSchema<LogoCloudData>({
|
|
322
|
+
label: 'Logo cloud',
|
|
323
|
+
itemLabel: 'heading',
|
|
324
|
+
fields: {
|
|
325
|
+
heading,
|
|
326
|
+
compact: { type: 'boolean', label: 'Compact', help: 'Less space around the section.' },
|
|
327
|
+
logos: {
|
|
328
|
+
type: 'list',
|
|
329
|
+
label: 'Logos',
|
|
330
|
+
itemLabel: 'name',
|
|
331
|
+
of: {
|
|
332
|
+
type: 'object',
|
|
333
|
+
fields: {
|
|
334
|
+
name: { type: 'text', label: 'Company name', required: true, help: 'Used as the logo’s alt text.' },
|
|
335
|
+
image: { type: 'image', label: 'Logo', required: true },
|
|
336
|
+
href: { type: 'link', label: 'Link' },
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
variant: { type: 'select', label: 'Layout', options: [{ value: 'grid', label: 'Grid' }, { value: 'strip', label: 'One row' }] },
|
|
341
|
+
columns: columns(['2', '3', '4', '5', '6']),
|
|
342
|
+
size: { type: 'select', label: 'Logo size', options: sizes },
|
|
343
|
+
mono: { type: 'boolean', label: 'One color', help: 'Shows every logo in grey.' },
|
|
344
|
+
tile: { type: 'boolean', label: 'Tiles', help: 'Puts each logo on its own tile.' },
|
|
345
|
+
settings: settingsField(),
|
|
346
|
+
},
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
export const contactCardSchema = blockSchema<ContactCardData>({
|
|
350
|
+
label: 'Contact details',
|
|
351
|
+
itemLabel: 'heading',
|
|
352
|
+
fields: {
|
|
353
|
+
eyebrow,
|
|
354
|
+
heading,
|
|
355
|
+
description: intro,
|
|
356
|
+
items: {
|
|
357
|
+
type: 'list',
|
|
358
|
+
label: 'Details',
|
|
359
|
+
itemLabel: 'value',
|
|
360
|
+
of: {
|
|
361
|
+
type: 'object',
|
|
362
|
+
fields: {
|
|
363
|
+
type: { type: 'select', label: 'Type', required: true, options: contactTypes },
|
|
364
|
+
label: { type: 'text', label: 'Label', help: 'Leave empty for the default (“Phone”, “Email”…).' },
|
|
365
|
+
value: { type: 'text', label: 'Value', required: true },
|
|
366
|
+
href: { type: 'link', label: 'Link', help: 'Only for links. Phone numbers and emails link themselves.' },
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
note: { type: 'text', label: 'Note' },
|
|
371
|
+
variant: { type: 'select', label: 'Style', options: [{ value: 'outline', label: 'Outline' }, { value: 'plain', label: 'Plain' }] },
|
|
372
|
+
columns: columns(['1', '2', '3']),
|
|
373
|
+
settings: settingsField(),
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
export const stepsSchema = blockSchema<StepsData>({
|
|
378
|
+
label: 'Steps',
|
|
379
|
+
itemLabel: 'heading',
|
|
380
|
+
fields: {
|
|
381
|
+
eyebrow,
|
|
382
|
+
heading,
|
|
383
|
+
description: intro,
|
|
384
|
+
items: {
|
|
385
|
+
type: 'list',
|
|
386
|
+
label: 'Steps',
|
|
387
|
+
itemLabel: 'title',
|
|
388
|
+
of: { type: 'object', fields: { title: { type: 'text', label: 'Title', required: true }, description: { type: 'textarea', label: 'Description' }, icon: iconField } },
|
|
389
|
+
},
|
|
390
|
+
marker: { type: 'select', label: 'Marker', options: [{ value: 'number', label: 'Numbers' }, { value: 'icon', label: 'Icons' }, { value: 'none', label: 'None' }] },
|
|
391
|
+
layout: { type: 'select', label: 'Layout', options: [{ value: 'row', label: 'In a row' }, { value: 'list', label: 'Top to bottom' }] },
|
|
392
|
+
variant: { type: 'select', label: 'Style', options: [{ value: 'plain', label: 'Plain' }, { value: 'card', label: 'Cards' }] },
|
|
393
|
+
settings: settingsField(),
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
export const mediaTextSchema = blockSchema<MediaTextData>({
|
|
398
|
+
label: 'Image and text',
|
|
399
|
+
itemLabel: 'heading',
|
|
400
|
+
fields: {
|
|
401
|
+
eyebrow,
|
|
402
|
+
heading,
|
|
403
|
+
description: { type: 'textarea', label: 'Text' },
|
|
404
|
+
points: { type: 'list', label: 'Bullet points', of: { type: 'text', label: 'Point' } },
|
|
405
|
+
actions: actionsField(2),
|
|
406
|
+
image,
|
|
407
|
+
imageAlt,
|
|
408
|
+
mediaPosition,
|
|
409
|
+
mediaAspect: {
|
|
410
|
+
type: 'select',
|
|
411
|
+
label: 'Image shape',
|
|
412
|
+
options: [{ value: '1/1', label: 'Square' }, { value: '4/3', label: 'Classic (4:3)' }, { value: '3/2', label: 'Photo (3:2)' }, { value: '16/9', label: 'Wide (16:9)' }, { value: '4/5', label: 'Portrait (4:5)' }],
|
|
413
|
+
},
|
|
414
|
+
settings: settingsField(),
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
export const statsBandSchema = blockSchema<StatsBandData>({
|
|
419
|
+
label: 'Stats band',
|
|
420
|
+
itemLabel: 'heading',
|
|
421
|
+
fields: {
|
|
422
|
+
heading,
|
|
423
|
+
label: { type: 'text', label: 'Name for screen readers', help: 'Used when there is no heading.' },
|
|
424
|
+
items: {
|
|
425
|
+
type: 'list',
|
|
426
|
+
label: 'Stats',
|
|
427
|
+
itemLabel: 'value',
|
|
428
|
+
of: { type: 'object', fields: { value: { type: 'text', label: 'Number', required: true, help: 'E.g. 25+ or 98%.' }, label: { type: 'text', label: 'Label', required: true }, icon: iconField } },
|
|
429
|
+
},
|
|
430
|
+
image: { type: 'image', label: 'Background image', help: 'Decorative: it has no alt text.' },
|
|
431
|
+
tone,
|
|
432
|
+
settings: settingsField(['anchor', 'spacing', 'align']),
|
|
433
|
+
},
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
export const highlightCardsSchema = blockSchema<HighlightCardsData>({
|
|
437
|
+
label: 'Highlight cards',
|
|
438
|
+
itemLabel: 'label',
|
|
439
|
+
fields: {
|
|
440
|
+
label: { type: 'text', label: 'Name for screen readers', help: 'Not shown on the page.' },
|
|
441
|
+
items: {
|
|
442
|
+
type: 'list',
|
|
443
|
+
label: 'Cards',
|
|
444
|
+
itemLabel: 'heading',
|
|
445
|
+
max: 4,
|
|
446
|
+
of: {
|
|
447
|
+
type: 'object',
|
|
448
|
+
fields: {
|
|
449
|
+
heading: { type: 'text', label: 'Heading', required: true },
|
|
450
|
+
description: { type: 'textarea', label: 'Description' },
|
|
451
|
+
points: { type: 'list', label: 'Bullet points', of: { type: 'text', label: 'Point' } },
|
|
452
|
+
actions: actionsField(1, 'Button'),
|
|
453
|
+
tone: { type: 'select', label: 'Color', options: [{ value: 'accent', label: 'Brand' }, { value: 'neutral', label: 'Neutral' }] },
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
overlap: { type: 'boolean', label: 'Overlap the section above' },
|
|
458
|
+
gap: { type: 'select', label: 'Gap between cards', options: [{ value: 'none', label: 'None' }, { value: 'm', label: 'Medium' }] },
|
|
459
|
+
settings: settingsField(['anchor', 'align']),
|
|
460
|
+
},
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
export const contactFormSchema = blockSchema<ContactFormData>({
|
|
464
|
+
label: 'Contact form',
|
|
465
|
+
itemLabel: 'heading',
|
|
466
|
+
fields: {
|
|
467
|
+
heading,
|
|
468
|
+
description: intro,
|
|
469
|
+
nameFields: { type: 'select', label: 'Name', options: [{ value: 'split', label: 'First and last name' }, { value: 'single', label: 'One name field' }] },
|
|
470
|
+
phone: { type: 'select', label: 'Phone number', options: [{ value: 'optional', label: 'Optional' }, { value: 'required', label: 'Required' }, { value: 'hidden', label: 'Don’t ask' }] },
|
|
471
|
+
messageLabel: { type: 'text', label: 'Message label' },
|
|
472
|
+
messageHint: { type: 'text', label: 'Message hint', help: 'Shown under the message box.' },
|
|
473
|
+
note: { type: 'textarea', label: 'Note', help: 'Small print under the form.' },
|
|
474
|
+
submitLabel: { type: 'text', label: 'Button label' },
|
|
475
|
+
fallbackPhone: { type: 'text', label: 'Phone if sending fails' },
|
|
476
|
+
fallbackEmail: { type: 'text', label: 'Email if sending fails' },
|
|
477
|
+
settings: settingsField(),
|
|
478
|
+
},
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
export const proseSectionSchema = blockSchema<ProseSectionData>({
|
|
482
|
+
label: 'Text section',
|
|
483
|
+
itemLabel: 'heading',
|
|
484
|
+
fields: {
|
|
485
|
+
eyebrow,
|
|
486
|
+
heading,
|
|
487
|
+
body: { ...richText, label: 'Text' },
|
|
488
|
+
actions: actionsField(2),
|
|
489
|
+
measure: { type: 'boolean', label: 'Narrow column', help: 'Keeps lines short and easy to read.', default: true },
|
|
490
|
+
size: { type: 'select', label: 'Text size', options: sizes },
|
|
491
|
+
settings: settingsField(),
|
|
492
|
+
},
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
export const faqSchema = blockSchema<FaqData>({
|
|
496
|
+
label: 'FAQ',
|
|
497
|
+
itemLabel: 'heading',
|
|
498
|
+
fields: {
|
|
499
|
+
eyebrow,
|
|
500
|
+
heading,
|
|
501
|
+
description: intro,
|
|
502
|
+
items: {
|
|
503
|
+
type: 'list',
|
|
504
|
+
label: 'Questions',
|
|
505
|
+
itemLabel: 'question',
|
|
506
|
+
of: {
|
|
507
|
+
type: 'object',
|
|
508
|
+
fields: {
|
|
509
|
+
question: { type: 'text', label: 'Question', required: true },
|
|
510
|
+
answer: { ...richText, label: 'Answer', required: true, rows: 4 },
|
|
511
|
+
anchor: { type: 'text', label: 'Anchor', help: 'Lets you link straight to this question. Lowercase letters, numbers and dashes.', pattern: '[a-z0-9-]+' },
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
layout: { type: 'select', label: 'Layout', options: [{ value: 'stacked', label: 'Heading above' }, { value: 'split', label: 'Heading beside' }] },
|
|
516
|
+
variant: { type: 'select', label: 'Style', options: [{ value: 'divided', label: 'Divided' }, { value: 'card', label: 'Cards' }] },
|
|
517
|
+
mode: { type: 'select', label: 'Open answers', options: [{ value: 'multiple', label: 'Several at once' }, { value: 'single', label: 'One at a time' }] },
|
|
518
|
+
openFirst: { type: 'boolean', label: 'Open the first answer' },
|
|
519
|
+
actions: actionsField(2),
|
|
520
|
+
settings: settingsField(),
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
export const testimonialsSchema = blockSchema<TestimonialsData>({
|
|
525
|
+
label: 'Testimonials',
|
|
526
|
+
itemLabel: 'heading',
|
|
527
|
+
fields: {
|
|
528
|
+
eyebrow,
|
|
529
|
+
heading,
|
|
530
|
+
description: intro,
|
|
531
|
+
items: {
|
|
532
|
+
type: 'list',
|
|
533
|
+
label: 'Testimonials',
|
|
534
|
+
itemLabel: 'name',
|
|
535
|
+
of: {
|
|
536
|
+
type: 'object',
|
|
537
|
+
fields: {
|
|
538
|
+
quote: { type: 'textarea', label: 'Quote', required: true },
|
|
539
|
+
name: { type: 'text', label: 'Name', required: true },
|
|
540
|
+
role: { type: 'text', label: 'Role' },
|
|
541
|
+
organization: { type: 'text', label: 'Organization' },
|
|
542
|
+
image: { type: 'image', label: 'Photo' },
|
|
543
|
+
rating,
|
|
544
|
+
sourceLabel: { type: 'text', label: 'Source', help: 'Where it was posted, e.g. Google.' },
|
|
545
|
+
sourceHref: { type: 'link', label: 'Source link' },
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
layout: { type: 'select', label: 'Layout', options: [{ value: 'grid', label: 'Grid' }, { value: 'single', label: 'One at a time' }] },
|
|
550
|
+
variant: { type: 'select', label: 'Style', options: [{ value: 'card', label: 'Cards' }, { value: 'plain', label: 'Plain' }] },
|
|
551
|
+
columns: columns(['1', '2', '3']),
|
|
552
|
+
actions: actionsField(2),
|
|
553
|
+
settings: settingsField(),
|
|
554
|
+
},
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
export const reviewsSchema = blockSchema<ReviewsData>({
|
|
558
|
+
label: 'Reviews',
|
|
559
|
+
itemLabel: 'heading',
|
|
560
|
+
fields: {
|
|
561
|
+
eyebrow,
|
|
562
|
+
heading,
|
|
563
|
+
description: intro,
|
|
564
|
+
summary: {
|
|
565
|
+
type: 'object',
|
|
566
|
+
label: 'Overall rating',
|
|
567
|
+
fields: {
|
|
568
|
+
rating: { ...rating, label: 'Average rating' },
|
|
569
|
+
count: { type: 'number', label: 'Number of reviews', min: 1, integer: true },
|
|
570
|
+
source: { type: 'text', label: 'Source', help: 'E.g. Google.' },
|
|
571
|
+
href: { type: 'link', label: 'Link to all reviews' },
|
|
572
|
+
writeHref: { type: 'link', label: 'Link to write a review' },
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
items: {
|
|
576
|
+
type: 'list',
|
|
577
|
+
label: 'Reviews',
|
|
578
|
+
itemLabel: 'author',
|
|
579
|
+
of: {
|
|
580
|
+
type: 'object',
|
|
581
|
+
fields: {
|
|
582
|
+
text: { type: 'textarea', label: 'Review', required: true },
|
|
583
|
+
author: { type: 'text', label: 'Author', required: true },
|
|
584
|
+
rating: { ...rating, required: true },
|
|
585
|
+
date: { ...isoDate, label: 'Date' },
|
|
586
|
+
sourceLabel: { type: 'text', label: 'Source' },
|
|
587
|
+
sourceHref: { type: 'link', label: 'Source link' },
|
|
588
|
+
response: { type: 'textarea', label: 'Our reply' },
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
},
|
|
592
|
+
variant: { type: 'select', label: 'Style', options: [{ value: 'card', label: 'Cards' }, { value: 'plain', label: 'Plain' }] },
|
|
593
|
+
columns: columns(['1', '2', '3']),
|
|
594
|
+
settings: settingsField(),
|
|
595
|
+
},
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
const dayOptions = [
|
|
599
|
+
{ value: 'Mo', label: 'Monday' },
|
|
600
|
+
{ value: 'Tu', label: 'Tuesday' },
|
|
601
|
+
{ value: 'We', label: 'Wednesday' },
|
|
602
|
+
{ value: 'Th', label: 'Thursday' },
|
|
603
|
+
{ value: 'Fr', label: 'Friday' },
|
|
604
|
+
{ value: 'Sa', label: 'Saturday' },
|
|
605
|
+
{ value: 'Su', label: 'Sunday' },
|
|
606
|
+
];
|
|
607
|
+
|
|
608
|
+
export const locationHoursSchema = blockSchema<LocationHoursData>({
|
|
609
|
+
label: 'Location and hours',
|
|
610
|
+
itemLabel: 'heading',
|
|
611
|
+
fields: {
|
|
612
|
+
eyebrow,
|
|
613
|
+
heading,
|
|
614
|
+
description: intro,
|
|
615
|
+
name: { type: 'text', label: 'Business name' },
|
|
616
|
+
address: {
|
|
617
|
+
type: 'object',
|
|
618
|
+
label: 'Address',
|
|
619
|
+
fields: {
|
|
620
|
+
street: { type: 'text', label: 'Street', required: true },
|
|
621
|
+
street2: { type: 'text', label: 'Suite, unit' },
|
|
622
|
+
city: { type: 'text', label: 'City', required: true },
|
|
623
|
+
region: { type: 'text', label: 'State' },
|
|
624
|
+
postalCode: { type: 'text', label: 'ZIP code' },
|
|
625
|
+
country: { type: 'text', label: 'Country code', help: 'Two letters, e.g. US.', pattern: '[A-Za-z]{2}' },
|
|
626
|
+
},
|
|
627
|
+
},
|
|
628
|
+
phone: { type: 'text', label: 'Phone' },
|
|
629
|
+
email: { type: 'text', label: 'Email' },
|
|
630
|
+
hours: {
|
|
631
|
+
type: 'list',
|
|
632
|
+
label: 'Opening hours',
|
|
633
|
+
of: {
|
|
634
|
+
type: 'object',
|
|
635
|
+
fields: {
|
|
636
|
+
days: { type: 'list', label: 'Days', min: 1, of: { type: 'select', label: 'Day', options: dayOptions } },
|
|
637
|
+
opens: { ...time, label: 'Opens' },
|
|
638
|
+
closes: { ...time, label: 'Closes' },
|
|
639
|
+
closed: { type: 'boolean', label: 'Closed these days' },
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
},
|
|
643
|
+
special: {
|
|
644
|
+
type: 'list',
|
|
645
|
+
label: 'Holidays and special hours',
|
|
646
|
+
itemLabel: 'label',
|
|
647
|
+
of: {
|
|
648
|
+
type: 'object',
|
|
649
|
+
fields: {
|
|
650
|
+
date: { ...isoDate, label: 'Date', required: true },
|
|
651
|
+
label: { type: 'text', label: 'Name', help: 'E.g. Thanksgiving.' },
|
|
652
|
+
opens: { ...time, label: 'Opens' },
|
|
653
|
+
closes: { ...time, label: 'Closes' },
|
|
654
|
+
closed: { type: 'boolean', label: 'Closed all day' },
|
|
655
|
+
},
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
hoursNote: { type: 'text', label: 'Note about hours' },
|
|
659
|
+
timeZone: { type: 'text', label: 'Time zone', help: 'For “Open now”. E.g. America/Chicago.', placeholder: 'America/Chicago' },
|
|
660
|
+
map: { type: 'select', label: 'Map', options: [{ value: 'embed', label: 'Embedded map' }, { value: 'link', label: 'Link to a map' }, { value: 'none', label: 'No map' }] },
|
|
661
|
+
// A text field with a pattern, not a link: the block only embeds https:// URLs, and a link
|
|
662
|
+
// field would accept page paths that then show no map.
|
|
663
|
+
mapEmbedUrl: {
|
|
664
|
+
type: 'text',
|
|
665
|
+
label: 'Map embed URL',
|
|
666
|
+
help: 'The https:// address from Google Maps’ “Embed a map”.',
|
|
667
|
+
pattern: 'https://\\S+',
|
|
668
|
+
patternMessage: 'Paste the full address, starting with https://.',
|
|
669
|
+
},
|
|
670
|
+
layout: { type: 'select', label: 'Layout', options: [{ value: 'split', label: 'Side by side' }, { value: 'stacked', label: 'Stacked' }] },
|
|
671
|
+
settings: settingsField(),
|
|
672
|
+
},
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
/** A copy of a block schema without some of its fields (stored values are kept, just not editable). */
|
|
676
|
+
export function withoutFields<B extends BlockSchema>(schema: B, keys: Array<keyof B['fields'] & string>): B {
|
|
677
|
+
return { ...schema, fields: Object.fromEntries(Object.entries(schema.fields).filter(([k]) => !keys.includes(k))) };
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/** Every block, keyed by its `_template` name: pass to `fields.blocks({ types: blockSchemas })`. */
|
|
681
|
+
export const blockSchemas = {
|
|
682
|
+
hero: heroSchema,
|
|
683
|
+
heroCarousel: heroCarouselSchema,
|
|
684
|
+
pageHeader: pageHeaderSchema,
|
|
685
|
+
ctaBanner: ctaBannerSchema,
|
|
686
|
+
ctaPair: ctaPairSchema,
|
|
687
|
+
featureGrid: featureGridSchema,
|
|
688
|
+
cardGrid: cardGridSchema,
|
|
689
|
+
logoCloud: logoCloudSchema,
|
|
690
|
+
contactCard: contactCardSchema,
|
|
691
|
+
steps: stepsSchema,
|
|
692
|
+
mediaText: mediaTextSchema,
|
|
693
|
+
statsBand: statsBandSchema,
|
|
694
|
+
highlightCards: highlightCardsSchema,
|
|
695
|
+
contactForm: contactFormSchema,
|
|
696
|
+
proseSection: proseSectionSchema,
|
|
697
|
+
faq: faqSchema,
|
|
698
|
+
testimonials: testimonialsSchema,
|
|
699
|
+
reviews: reviewsSchema,
|
|
700
|
+
locationHours: locationHoursSchema,
|
|
701
|
+
} satisfies Record<string, BlockSchema>;
|
|
702
|
+
|
|
703
|
+
// --- Site settings ---------------------------------------------------------------------------
|
|
704
|
+
|
|
705
|
+
/** `topbar` in site settings → `topbarProps(settings.topbar)`. */
|
|
706
|
+
export const topbarSchema: ObjectField = objectSchema<TopbarData>({
|
|
707
|
+
label: 'Top bar',
|
|
708
|
+
fields: {
|
|
709
|
+
message: { type: 'text', label: 'Message', help: 'A short notice, e.g. holiday hours.' },
|
|
710
|
+
items: {
|
|
711
|
+
type: 'list',
|
|
712
|
+
label: 'Contact details',
|
|
713
|
+
itemLabel: 'value',
|
|
714
|
+
of: {
|
|
715
|
+
type: 'object',
|
|
716
|
+
fields: {
|
|
717
|
+
type: { type: 'select', label: 'Type', required: true, options: contactTypes },
|
|
718
|
+
value: { type: 'text', label: 'Value', required: true },
|
|
719
|
+
href: { type: 'link', label: 'Link', help: 'Only for links. Phone numbers and emails link themselves.' },
|
|
720
|
+
label: { type: 'text', label: 'Label for screen readers' },
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
links: {
|
|
725
|
+
type: 'list',
|
|
726
|
+
label: 'Links',
|
|
727
|
+
itemLabel: 'label',
|
|
728
|
+
of: {
|
|
729
|
+
type: 'object',
|
|
730
|
+
fields: {
|
|
731
|
+
label: { type: 'text', label: 'Label', required: true },
|
|
732
|
+
href: { type: 'link', label: 'Link', required: true },
|
|
733
|
+
newTab: { type: 'boolean', label: 'Open in a new tab' },
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
},
|
|
737
|
+
background: { type: 'select', label: 'Background', options: [{ value: 'strong', label: 'Strong' }, { value: 'tinted', label: 'Tinted' }, { value: 'subtle', label: 'Subtle' }] },
|
|
738
|
+
tone: { type: 'select', label: 'Color', options: [{ value: 'neutral', label: 'Neutral' }, { value: 'accent', label: 'Brand' }] },
|
|
739
|
+
},
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
/** `consent` in site settings → `consentProps(settings.consent)`. */
|
|
743
|
+
export const consentSchema: ObjectField = objectSchema<ConsentData>({
|
|
744
|
+
label: 'Cookie banner',
|
|
745
|
+
fields: {
|
|
746
|
+
message: { type: 'textarea', label: 'Message', rows: 3 },
|
|
747
|
+
policyHref: { type: 'link', label: 'Privacy policy link' },
|
|
748
|
+
version: { type: 'text', label: 'Version', help: 'Change it to ask every visitor again, e.g. after adding analytics.' },
|
|
749
|
+
categories: {
|
|
750
|
+
type: 'list',
|
|
751
|
+
label: 'Categories',
|
|
752
|
+
of: {
|
|
753
|
+
type: 'select',
|
|
754
|
+
label: 'Category',
|
|
755
|
+
options: [{ value: 'media', label: 'Media (maps, videos)' }, { value: 'analytics', label: 'Analytics' }, { value: 'marketing', label: 'Marketing' }],
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
/** `errorPages` in site settings → `errorPageProps(settings.errorPages, status)`. */
|
|
762
|
+
export const errorPagesSchema: ObjectField = objectSchema<ErrorPagesSettings>({
|
|
763
|
+
label: 'Error pages',
|
|
764
|
+
fields: {
|
|
765
|
+
notFoundHeading: { type: 'text', label: '“Page not found” heading' },
|
|
766
|
+
notFoundDescription: { type: 'textarea', label: '“Page not found” text' },
|
|
767
|
+
serverErrorHeading: { type: 'text', label: '“Something went wrong” heading' },
|
|
768
|
+
serverErrorDescription: { type: 'textarea', label: '“Something went wrong” text' },
|
|
769
|
+
links: {
|
|
770
|
+
type: 'list',
|
|
771
|
+
label: 'Helpful links',
|
|
772
|
+
itemLabel: 'label',
|
|
773
|
+
of: {
|
|
774
|
+
type: 'object',
|
|
775
|
+
fields: {
|
|
776
|
+
label: { type: 'text', label: 'Label', required: true },
|
|
777
|
+
href: { type: 'link', label: 'Link', required: true },
|
|
778
|
+
description: { type: 'text', label: 'Description' },
|
|
779
|
+
icon: iconField,
|
|
780
|
+
},
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
contactText: { type: 'text', label: 'Contact text', help: 'E.g. “Still stuck?”' },
|
|
784
|
+
contactLabel: { type: 'text', label: 'Contact link label' },
|
|
785
|
+
contactHref: { type: 'link', label: 'Contact link' },
|
|
786
|
+
},
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
/** The site-settings fields the blocks read, for a settings collection's `fields`. */
|
|
790
|
+
export const siteSettingsFields = {
|
|
791
|
+
topbar: topbarSchema,
|
|
792
|
+
consent: consentSchema,
|
|
793
|
+
errorPages: errorPagesSchema,
|
|
794
|
+
};
|