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/TextArea/TextArea.tsx | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

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

diff --git a/src/components/Form/TextArea/TextArea.tsx b/src/components/Form/TextArea/TextArea.tsx
index e1e7e0f..b8894ab 100644
--- a/src/components/Form/TextArea/TextArea.tsx
+++ b/src/components/Form/TextArea/TextArea.tsx
@@ -1,4 +1,4 @@
-import { ChangeEvent, SetStateAction } from 'react';
+import { ChangeEvent, ReactElement, SetStateAction } from 'react';
 import styles from '../Form.module.scss';
 
 const TextArea = ({
@@ -6,15 +6,13 @@ const TextArea = ({
   name,
   value,
   setValue,
-  required = false,
   label,
 }: {
   id: string;
   name: string;
   value: string;
   setValue: (value: SetStateAction<string>) => void;
-  required?: boolean;
-  label?: string;
+  label?: ReactElement;
 }) => {
   const updateValue = (e: ChangeEvent<HTMLTextAreaElement>) => {
     setValue(e.target.value);
@@ -22,12 +20,7 @@ const TextArea = ({
 
   return (
     <>
-      {label && (
-        <label htmlFor={id} className={styles.label}>
-          {label}
-          {required && <span className={styles.required}> *</span>}
-        </label>
-      )}
+      {label}
       <textarea
         id={id}
         name={name}
-- 
cgit v1.2.3

