From cb4764f8670f67627c407591c89b8d3637c190a7 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 25 Feb 2022 18:02:55 +0100
Subject: refactor: replace label elements with Label component

---
 src/components/Form/Input/Input.tsx | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

(limited to 'src/components/Form/Input/Input.tsx')

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}
-- 
cgit v1.2.3

