x
This commit is contained in:
1 parent
b641acbeb7
commit
e349ef5b84
14 files changed
+720
-558
No files matched your search
+26
-10
@@ -599,6 +599,24 @@ export interface CategorySection {
|
||||
|
||||
export const LocalizedStringSchema = z.union([z.string(), z.record(z.string(), z.string())]);
|
||||
|
||||
export const ContentPositionSchema = z.enum([
|
||||
'top-left', 'top-center', 'top-right',
|
||||
'center-left', 'center', 'center-right',
|
||||
'bottom-left', 'bottom-center', 'bottom-right'
|
||||
]);
|
||||
export type ContentPosition = z.infer<typeof ContentPositionSchema>;
|
||||
|
||||
export const OptionalContentPositionSchema = z
|
||||
.union([ContentPositionSchema, z.literal(''), z.null()])
|
||||
.optional()
|
||||
.transform((val) => (val ? (val as ContentPosition) : undefined));
|
||||
|
||||
export const DesktopContentPositionSchema = (fallback: ContentPosition) =>
|
||||
z
|
||||
.union([ContentPositionSchema, z.literal(''), z.null()])
|
||||
.optional()
|
||||
.transform((val) => (val ? (val as ContentPosition) : fallback));
|
||||
|
||||
export const HeroSectionPayloadSchema = z.object({
|
||||
tagline: LocalizedStringSchema.optional(),
|
||||
title: LocalizedStringSchema.optional(),
|
||||
@@ -607,16 +625,8 @@ export const HeroSectionPayloadSchema = z.object({
|
||||
buttonText: LocalizedStringSchema.optional(),
|
||||
buttonLink: z.string().optional(),
|
||||
focalPoint: z.object({ x: z.string(), y: z.string() }).optional(),
|
||||
buttonPosition: z.enum([
|
||||
'top-left', 'top-center', 'top-right',
|
||||
'center-left', 'center', 'center-right',
|
||||
'bottom-left', 'bottom-center', 'bottom-right'
|
||||
]).optional().default('center'),
|
||||
mobileButtonPosition: z.enum([
|
||||
'top-left', 'top-center', 'top-right',
|
||||
'center-left', 'center', 'center-right',
|
||||
'bottom-left', 'bottom-center', 'bottom-right'
|
||||
]).optional(),
|
||||
buttonPosition: DesktopContentPositionSchema('center'),
|
||||
mobileButtonPosition: OptionalContentPositionSchema,
|
||||
overlayStyle: z.enum(['gradient', 'solid', 'none']).optional().default('gradient'),
|
||||
overlayOpacity: z.number().min(0).max(100).optional(),
|
||||
});
|
||||
@@ -649,6 +659,8 @@ export const BannerSectionPayloadSchema = z.object({
|
||||
description: LocalizedStringSchema.optional(),
|
||||
buttonText: LocalizedStringSchema.optional(),
|
||||
focalPoint: z.object({ x: z.string(), y: z.string() }).optional(),
|
||||
buttonPosition: DesktopContentPositionSchema('center-left'),
|
||||
mobileButtonPosition: OptionalContentPositionSchema,
|
||||
});
|
||||
export type BannerSectionPayload = z.infer<typeof BannerSectionPayloadSchema>;
|
||||
|
||||
@@ -725,6 +737,8 @@ export const HeroVideoSectionPayloadSchema = z.object({
|
||||
backgroundColor: z.string().optional(),
|
||||
textColor: z.string().optional(),
|
||||
focalPoint: z.object({ x: z.string(), y: z.string() }).optional(),
|
||||
buttonPosition: DesktopContentPositionSchema('center'),
|
||||
mobileButtonPosition: OptionalContentPositionSchema,
|
||||
});
|
||||
export type HeroVideoSectionPayload = z.infer<typeof HeroVideoSectionPayloadSchema>;
|
||||
|
||||
@@ -754,6 +768,8 @@ export const HeroCarouselSlideSchema = z.object({
|
||||
subtitle: LocalizedStringSchema.optional(),
|
||||
buttonText: LocalizedStringSchema.optional(),
|
||||
focalPoint: z.object({ x: z.string(), y: z.string() }).optional(),
|
||||
buttonPosition: DesktopContentPositionSchema('bottom-left'),
|
||||
mobileButtonPosition: OptionalContentPositionSchema,
|
||||
});
|
||||
export type HeroCarouselSlide = z.infer<typeof HeroCarouselSlideSchema>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user