2
0

♻️ (models) Change to features-centric folder structure

This commit is contained in:
Baptiste Arnaud
2022-11-15 11:02:26 +01:00
committed by Baptiste Arnaud
parent a9d04798bc
commit a5c8a8a95c
55 changed files with 37 additions and 43 deletions

View File

@ -0,0 +1,36 @@
import { z } from 'zod'
import { InputBlockType, optionBaseSchema, blockBaseSchema } from '../shared'
export const fileInputOptionsSchema = optionBaseSchema.and(
z.object({
isRequired: z.boolean().optional(),
isMultipleAllowed: z.boolean(),
labels: z.object({
placeholder: z.string(),
button: z.string(),
}),
sizeLimit: z.number().optional(),
})
)
export const fileInputStepSchema = blockBaseSchema.and(
z.object({
type: z.literal(InputBlockType.FILE),
options: fileInputOptionsSchema,
})
)
export const defaultFileInputOptions: FileInputOptions = {
isRequired: true,
isMultipleAllowed: false,
labels: {
placeholder: `<strong>
Click to upload
</strong> or drag and drop<br>
(size limit: 10MB)`,
button: 'Upload',
},
}
export type FileInputBlock = z.infer<typeof fileInputStepSchema>
export type FileInputOptions = z.infer<typeof fileInputOptionsSchema>