From e5542f9b46ae8382491b2617c60568a358583353 Mon Sep 17 00:00:00 2001 From: LEEJW1953 Date: Thu, 23 Nov 2023 11:43:22 +0900 Subject: [PATCH 01/12] =?UTF-8?q?:sparkles:=20Input,=20Textarea=20?= =?UTF-8?q?=EA=B8=80=EC=9E=90=EC=88=98=20=ED=91=9C=EC=8B=9C=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit react hook form을 통해 표시할 예정 --- .../src/components/commons/Input/Textarea.tsx | 22 ++++++------------- .../src/components/commons/Input/index.tsx | 22 +++++++------------ 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/app/frontend/src/components/commons/Input/Textarea.tsx b/app/frontend/src/components/commons/Input/Textarea.tsx index 2da00d5a1..8677195b1 100644 --- a/app/frontend/src/components/commons/Input/Textarea.tsx +++ b/app/frontend/src/components/commons/Input/Textarea.tsx @@ -1,5 +1,3 @@ -import { useRef, useState } from 'react'; - import * as styles from './Textarea.css'; type TextareaProps = { @@ -11,6 +9,8 @@ type TextareaProps = { required?: boolean; fullWidth?: boolean; rows?: number; + value: string; + onChange: () => void; }; export function Textarea({ @@ -22,16 +22,9 @@ export function Textarea({ required = false, fullWidth = false, rows = 2, + value, + onChange, }: TextareaProps) { - const [textCount, setTextCount] = useState(0); - const textRef = useRef(null); - - const handleInput = () => { - if (textRef && textRef.current) { - setTextCount(textRef.current.value.length); - } - }; - return (
*} - {textCount}/{maxLength} + {value ? value.length : 0}/{maxLength}