summaryrefslogtreecommitdiffstats
path: root/src/components/Form/Input/Input.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-02-25 18:02:55 +0100
committerArmand Philippot <git@armandphilippot.com>2022-02-25 18:13:49 +0100
commitcb4764f8670f67627c407591c89b8d3637c190a7 (patch)
treebc95737e6d7f3ccca1b40c469591c5687327ddeb /src/components/Form/Input/Input.tsx
parent774d5b4c538d93889bf743b6cd7d01a85f8715e6 (diff)
refactor: replace label elements with Label component
Diffstat (limited to 'src/components/Form/Input/Input.tsx')
-rw-r--r--src/components/Form/Input/Input.tsx19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/components/Form/Input/Input.tsx b/src/components/Form/Input/Input.tsx
index 986ea63..07f0410 100644
--- a/src/components/Form/Input/Input.tsx
+++ b/src/components/Form/Input/Input.tsx
@@ -1,4 +1,10 @@
-import { ChangeEvent, ForwardedRef, forwardRef, SetStateAction } from 'react';
+import {
+ ChangeEvent,
+ ForwardedRef,
+ forwardRef,
+ ReactElement,
+ SetStateAction,
+} from 'react';
import styles from '../Form.module.scss';
type InputType = 'text' | 'email' | 'number' | 'search';
@@ -10,7 +16,6 @@ const Input = (
value,
setValue,
type = 'text',
- required = false,
label,
}: {
id: string;
@@ -18,8 +23,7 @@ const Input = (
value: string;
setValue: (value: SetStateAction<string>) => void;
type?: InputType;
- required?: boolean;
- label?: string;
+ label?: ReactElement;
},
ref: ForwardedRef<HTMLInputElement>
) => {
@@ -29,12 +33,7 @@ const Input = (
return (
<>
- {label && (
- <label htmlFor={id} className={styles.label}>
- {label}
- {required && <span className={styles.required}> *</span>}
- </label>
- )}
+ {label}
<input
ref={ref}
type={type}