mirror of
https://github.com/ershisan99/flashcards-example-project.git
synced 2025-12-18 05:09:23 +00:00
chore: lint with tabwidth: 2
This commit is contained in:
@@ -3,34 +3,34 @@ import { FieldValues, UseControllerProps, useController } from 'react-hook-form'
|
||||
import { Checkbox, CheckboxProps } from '../../'
|
||||
|
||||
export type ControlledCheckboxProps<TFieldValues extends FieldValues> =
|
||||
UseControllerProps<TFieldValues> & Omit<CheckboxProps, 'id' | 'onChange' | 'value'>
|
||||
UseControllerProps<TFieldValues> & Omit<CheckboxProps, 'id' | 'onChange' | 'value'>
|
||||
|
||||
export const ControlledCheckbox = <TFieldValues extends FieldValues>({
|
||||
control,
|
||||
defaultValue,
|
||||
name,
|
||||
rules,
|
||||
shouldUnregister,
|
||||
...checkboxProps
|
||||
}: ControlledCheckboxProps<TFieldValues>) => {
|
||||
const {
|
||||
field: { onChange, value },
|
||||
} = useController({
|
||||
control,
|
||||
defaultValue,
|
||||
name,
|
||||
rules,
|
||||
shouldUnregister,
|
||||
...checkboxProps
|
||||
}: ControlledCheckboxProps<TFieldValues>) => {
|
||||
const {
|
||||
field: { onChange, value },
|
||||
} = useController({
|
||||
control,
|
||||
defaultValue,
|
||||
name,
|
||||
rules,
|
||||
shouldUnregister,
|
||||
})
|
||||
})
|
||||
|
||||
return (
|
||||
<Checkbox
|
||||
{...{
|
||||
checked: value,
|
||||
id: name,
|
||||
onChange,
|
||||
...checkboxProps,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
return (
|
||||
<Checkbox
|
||||
{...{
|
||||
checked: value,
|
||||
id: name,
|
||||
onChange,
|
||||
...checkboxProps,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user