diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-02-25 19:17:09 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-02-25 19:17:09 +0100 |
| commit | e26d821f738525477472e631d170d9ed218c1603 (patch) | |
| tree | 70ec0c29d003d462de6926f1faa09354e3ff6d90 /src/components/Form/Input/Input.tsx | |
| parent | cb4764f8670f67627c407591c89b8d3637c190a7 (diff) | |
chore: combine input/textarea/select in a single component
Diffstat (limited to 'src/components/Form/Input/Input.tsx')
| -rw-r--r-- | src/components/Form/Input/Input.tsx | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/components/Form/Input/Input.tsx b/src/components/Form/Input/Input.tsx deleted file mode 100644 index 07f0410..0000000 --- a/src/components/Form/Input/Input.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { - ChangeEvent, - ForwardedRef, - forwardRef, - ReactElement, - SetStateAction, -} from 'react'; -import styles from '../Form.module.scss'; - -type InputType = 'text' | 'email' | 'number' | 'search'; - -const Input = ( - { - id, - name, - value, - setValue, - type = 'text', - label, - }: { - id: string; - name: string; - value: string; - setValue: (value: SetStateAction<string>) => void; - type?: InputType; - label?: ReactElement; - }, - ref: ForwardedRef<HTMLInputElement> -) => { - const updateValue = (e: ChangeEvent<HTMLInputElement>) => { - setValue(e.target.value); - }; - - return ( - <> - {label} - <input - ref={ref} - type={type} - id={id} - name={name} - value={value} - onChange={updateValue} - className={styles.field} - /> - </> - ); -}; - -export default forwardRef(Input); |
