Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
vassbence committed Nov 14, 2024
1 parent 6d7b9bc commit e88720a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const FormContext = createContext<{
type TextFormField = { type: 'text' }
type TextAreaFormField = { type: 'textarea' }
type NumberFormField = { type: 'number' }
type SwitchFormField = { type: 'switch' }
type CheckboxFormField = { type: 'checkbox' }
type SwitchFormField = { type: 'switch'; switchLabel?: string }
type CheckboxFormField = { type: 'checkbox'; checkboxLabel?: string }
type DateFormField = { type: 'date' }
type DateTimeFormField = { type: 'datetime' }
type SelectFormField = {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Form/FormFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function FormFields(_: FormFieldsProps) {
disabled={form.isSubmitting || form.isDisabledFromOutside}
value={getByPath(form.values, path) as boolean | undefined}
onChange={(value) => form.setValue(path, value)}
error={!!getByPath(form.errors, path)}
label={field.switchLabel}
/>
)
case 'checkbox':
Expand All @@ -74,6 +74,7 @@ function FormFields(_: FormFieldsProps) {
value={getByPath(form.values, path) as boolean | undefined}
onChange={(value) => form.setValue(path, value)}
error={!!getByPath(form.errors, path)}
label={field.checkboxLabel}
/>
)
case 'number':
Expand Down

0 comments on commit e88720a

Please sign in to comment.