-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathcontent.config.ts
92 lines (87 loc) · 2.85 KB
/
content.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { defineCollection, z } from '@nuxt/content'
const createEnum = (options: [string, ...string[]]) => z.enum(options)
const createBaseSchema = () => z.object({
title: z.string().nonempty(),
description: z.string().nonempty()
})
const createLinkSchema = () => z.object({
label: z.string().nonempty(),
to: z.string().nonempty(),
icon: z.string().optional().editor({ input: 'icon' }),
size: createEnum(['xs', 'sm', 'md', 'lg', 'xl']),
trailing: z.boolean().optional(),
target: createEnum(['_blank', '_self']),
color: createEnum(['primary', 'secondary', 'neutral', 'error', 'warning', 'success', 'info']),
variant: createEnum(['solid', 'outline', 'subtle', 'soft', 'ghost', 'link'])
})
const createFeatureSchema = () => createBaseSchema().extend({
icon: z.string().editor({ input: 'icon' }),
ui: z.object({
leading: z.string().optional()
}).editor({ hidden: true })
})
export const collections = {
content: defineCollection({
source: 'index.yml',
type: 'page',
schema: z.object({
hero: z.object({
links: z.array(createLinkSchema())
}),
section: createBaseSchema().extend({
headline: z.string().optional(),
images: z.object({
mobile: z.string().optional(),
desktop: z.string().optional()
}),
features: z.array(
createBaseSchema().extend({
icon: z.string().editor({ input: 'icon' })
})
)
}),
features: createBaseSchema().extend({
features: z.array(createFeatureSchema())
}),
steps: createBaseSchema().extend({
items: z.array(createFeatureSchema().extend({
image: z.object({
light: z.string().editor({ input: 'media' }),
dark: z.string().editor({ input: 'media' })
}).optional()
}))
}),
pricing: createBaseSchema().extend({
plans: z.array(
createBaseSchema().extend({
price: z.string().nonempty(),
button: createLinkSchema(),
features: z.array(z.string().nonempty()),
highlight: z.boolean().optional(),
billing_period: z.string().nonempty(),
billing_cycle: z.string().nonempty()
})
)
}),
testimonials: createBaseSchema().extend({
items: z.array(
z.object({
quote: z.string().nonempty(),
user: z.object({
name: z.string().nonempty(),
description: z.string().nonempty(),
to: z.string().nonempty(),
avatar: z.object({
src: z.string().editor({ input: 'media' }),
alt: z.string().optional()
}),
target: createEnum(['_blank', '_self'])
})
}))
}),
cta: createBaseSchema().extend({
links: z.array(createLinkSchema())
})
})
})
}