2
0

feat(bot): ️ Add required option on file upload input

This commit is contained in:
Baptiste Arnaud
2022-06-25 09:24:47 +02:00
parent a4aa2938b7
commit 55108c80e8
7 changed files with 67 additions and 22 deletions

View File

@ -17,19 +17,27 @@ export const FileInputSettings = ({ options, onOptionsChange }: Props) => {
onOptionsChange({ ...options, labels: { ...options.labels, button } })
const handlePlaceholderLabelChange = (placeholder: string) =>
onOptionsChange({ ...options, labels: { ...options.labels, placeholder } })
const handleLongChange = (isMultipleAllowed: boolean) =>
const handleMultipleFilesChange = (isMultipleAllowed: boolean) =>
onOptionsChange({ ...options, isMultipleAllowed })
const handleVariableChange = (variable?: Variable) =>
onOptionsChange({ ...options, variableId: variable?.id })
const handleSizeLimitChange = (sizeLimit?: number) =>
onOptionsChange({ ...options, sizeLimit })
const handleRequiredChange = (isRequired: boolean) =>
onOptionsChange({ ...options, isRequired })
return (
<Stack spacing={4}>
<SwitchWithLabel
id="required"
label="Required?"
initialValue={options.isRequired ?? true}
onCheckChange={handleRequiredChange}
/>
<SwitchWithLabel
id="switch"
label="Allow multiple files?"
initialValue={options.isMultipleAllowed}
onCheckChange={handleLongChange}
onCheckChange={handleMultipleFilesChange}
/>
<Stack>
<FormLabel mb="0" htmlFor="limit">