diff options
Diffstat (limited to 'src/components/atoms/forms/boolean-field.tsx')
| -rw-r--r-- | src/components/atoms/forms/boolean-field.tsx | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/components/atoms/forms/boolean-field.tsx b/src/components/atoms/forms/boolean-field.tsx deleted file mode 100644 index 8f33a42..0000000 --- a/src/components/atoms/forms/boolean-field.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { FC, InputHTMLAttributes } from 'react'; -import styles from './boolean-field.module.scss'; - -export type BooleanFieldProps = Omit< - InputHTMLAttributes<HTMLInputElement>, - 'checked' | 'hidden' | 'name' | 'type' | 'value' -> & { - /** - * True if the field should be checked. - */ - checked: boolean; - /** - * True if the field should be visually hidden. Default: false. - */ - hidden?: boolean; - /** - * Field name attribute. - */ - name: string; - /** - * The input type. - */ - type: 'checkbox' | 'radio'; - /** - * Field name attribute. - */ - value: string; -}; - -/** - * BooleanField component - * - * Render a checkbox or a radio input type. - */ -export const BooleanField: FC<BooleanFieldProps> = ({ - className = '', - hidden = false, - ...props -}) => { - const modifier = hidden ? 'hidden' : ''; - const inputClass = `${styles[modifier]} ${className}`; - - return <input {...props} className={inputClass} />; -}; |
