@@ -7,6 +7,8 @@ export type Article = z.infer<ReturnType<typeof CreateArticleSchema>>;
77export type Member = z . infer < ReturnType < typeof CreateMemberSchema > > ;
88export type Project = z . infer < ReturnType < typeof CreateProjectSchema > > ;
99
10+ const Position = z . enum ( [ "center" , "top" , "bottom" , "left" , "right" ] ) ;
11+ const Fit = z . enum ( [ "cover" , "contain" , "fill" , "none" ] ) ;
1012export const CreateArticleSchema = ( { image } : { image : ImageFunction } ) =>
1113 z
1214 . object ( {
@@ -19,8 +21,8 @@ export const CreateArticleSchema = ({ image }: { image: ImageFunction }) =>
1921 categories : z . array ( z . string ( ) ) . optional ( ) ,
2022 // 画像系
2123 image : image ( ) ,
22- fit : z . enum ( [ "cover" , "contain" , "fill" , "none" ] ) . optional ( ) ,
23- position : z . enum ( [ "center" , "top" , "bottom" , "left" , "right" ] ) . optional ( ) ,
24+ fit : Fit . optional ( ) ,
25+ position : Position . default ( "center" ) ,
2426 bg_color : z . string ( ) . optional ( ) ,
2527 } )
2628 . refine (
@@ -51,7 +53,8 @@ export const CreateProjectSchema = ({ image }: { image: ImageFunction }) =>
5153 date : z . date ( ) ,
5254 image : z . object ( {
5355 src : image ( ) ,
54- fit : z . enum ( [ "cover" , "contain" , "fill" ] ) . optional ( ) . default ( "cover" ) ,
56+ position : Position . default ( "center" ) ,
57+ fit : Fit . default ( "cover" ) ,
5558 bg : z . string ( ) . optional ( ) . default ( "whitesmoke" ) ,
5659 } ) ,
5760 description : z . string ( ) ,
0 commit comments