2022-06-07 08:49:12 +02:00
|
|
|
import { z } from 'zod'
|
2023-11-08 15:34:16 +01:00
|
|
|
import { BubbleBlockType } from '../constants'
|
|
|
|
import { blockBaseSchema } from '../../shared'
|
2022-06-07 08:49:12 +02:00
|
|
|
|
|
|
|
export const imageBubbleContentSchema = z.object({
|
|
|
|
url: z.string().optional(),
|
2023-04-07 11:30:54 +02:00
|
|
|
clickLink: z
|
|
|
|
.object({
|
|
|
|
url: z.string().optional(),
|
|
|
|
alt: z.string().optional(),
|
|
|
|
})
|
|
|
|
.optional(),
|
2022-06-07 08:49:12 +02:00
|
|
|
})
|
|
|
|
|
2023-03-14 16:42:12 +01:00
|
|
|
export const imageBubbleBlockSchema = blockBaseSchema.merge(
|
2022-06-07 08:49:12 +02:00
|
|
|
z.object({
|
2022-06-11 07:27:38 +02:00
|
|
|
type: z.enum([BubbleBlockType.IMAGE]),
|
2023-11-08 15:34:16 +01:00
|
|
|
content: imageBubbleContentSchema.optional(),
|
2022-06-07 08:49:12 +02:00
|
|
|
})
|
|
|
|
)
|
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export type ImageBubbleBlock = z.infer<typeof imageBubbleBlockSchema>
|