@@ -3,6 +3,12 @@ import { defineCollection, z } from '@nuxt/content'
33const variantEnum = z . enum ( [ 'solid' , 'outline' , 'subtle' , 'soft' , 'ghost' , 'link' ] )
44const colorEnum = z . enum ( [ 'primary' , 'secondary' , 'neutral' , 'error' , 'warning' , 'success' , 'info' ] )
55const sizeEnum = z . enum ( [ 'xs' , 'sm' , 'md' , 'lg' , 'xl' ] )
6+ const orientationEnum = z . enum ( [ 'vertical' , 'horizontal' ] )
7+
8+ const baseSchema = {
9+ title : z . string ( ) . nonempty ( ) ,
10+ description : z . string ( ) . nonempty ( )
11+ }
612
713const linkSchema = z . object ( {
814 label : z . string ( ) . nonempty ( ) ,
@@ -22,19 +28,17 @@ const imageSchema = z.object({
2228 srcset : z . string ( ) . optional ( )
2329} )
2430
25- const sectionSchema = z . object ( {
26- headline : z . string ( ) . optional ( ) ,
27- title : z . string ( ) . nonempty ( ) ,
28- description : z . string ( ) . optional ( ) ,
29- variant : z . string ( ) . optional ( )
30- } )
31-
3231const featureItemSchema = z . object ( {
33- title : z . string ( ) . nonempty ( ) ,
34- description : z . string ( ) . nonempty ( ) ,
32+ ...baseSchema ,
3533 icon : z . string ( ) . nonempty ( )
3634} )
3735
36+ const sectionSchema = z . object ( {
37+ headline : z . string ( ) . optional ( ) ,
38+ ...baseSchema ,
39+ features : z . array ( featureItemSchema )
40+ } )
41+
3842export const collections = {
3943 docs : defineCollection ( {
4044 type : 'page' ,
@@ -50,22 +54,16 @@ export const collections = {
5054 schema : z . object ( {
5155 title : z . string ( ) . nonempty ( ) ,
5256 description : z . string ( ) . nonempty ( ) ,
53- image : z . object ( {
54- src : z . string ( ) . nonempty ( )
55- } ) ,
57+ image : z . object ( { src : z . string ( ) . nonempty ( ) } ) ,
5658 authors : z . array (
5759 z . object ( {
5860 name : z . string ( ) . nonempty ( ) ,
5961 to : z . string ( ) . nonempty ( ) ,
60- avatar : z . object ( {
61- src : z . string ( ) . nonempty ( )
62- } )
62+ avatar : z . object ( { src : z . string ( ) . nonempty ( ) } )
6363 } )
6464 ) ,
6565 date : z . string ( ) . nonempty ( ) ,
66- badge : z . object ( {
67- label : z . string ( ) . nonempty ( )
68- } )
66+ badge : z . object ( { label : z . string ( ) . nonempty ( ) } )
6967 } )
7068 } ) ,
7169 index : defineCollection ( {
@@ -85,17 +83,15 @@ export const collections = {
8583 sections : z . array (
8684 sectionSchema . extend ( {
8785 id : z . string ( ) . nonempty ( ) ,
88- orientation : z . enum ( [ 'vertical' , 'horizontal' ] ) . optional ( ) ,
86+ orientation : orientationEnum . optional ( ) ,
8987 features : z . array ( featureItemSchema ) ,
9088 links : z . array ( linkSchema ) ,
9189 reverse : z . boolean ( ) . optional ( )
9290 } )
9391 ) ,
94- features : z . array (
95- sectionSchema . extend ( {
96- items : z . array ( featureItemSchema )
97- } )
98- ) ,
92+ features : sectionSchema . extend ( {
93+ items : z . array ( featureItemSchema )
94+ } ) ,
9995 testimonials : sectionSchema . extend ( {
10096 items : z . array (
10197 z . object ( {
0 commit comments