From 80b89db6a782a60eee899f3a057e88edaefd6eb6 Mon Sep 17 00:00:00 2001 From: ttaerrim Date: Wed, 13 Dec 2023 00:23:18 +0900 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Textarea=EC=99=80=20TextLa?= =?UTF-8?q?bel=EC=9D=84=20=EB=82=98=EB=88=84=EC=96=B4=20FormTextarea?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/FormInput/Textarea.tsx | 40 +++++++++++++++++++ app/frontend/src/components/index.ts | 1 + .../MogacoPost/Controller/PostContents.tsx | 4 +- .../src/components/Input/Textarea.css.ts | 26 ------------ .../src/components/Input/Textarea.tsx | 19 ++------- .../src/components/Input/index.css.ts | 12 ++++++ 6 files changed, 58 insertions(+), 44 deletions(-) create mode 100644 app/frontend/src/components/FormInput/Textarea.tsx delete mode 100644 packages/morak-ui/src/components/Input/Textarea.css.ts diff --git a/app/frontend/src/components/FormInput/Textarea.tsx b/app/frontend/src/components/FormInput/Textarea.tsx new file mode 100644 index 000000000..b5bdc4cad --- /dev/null +++ b/app/frontend/src/components/FormInput/Textarea.tsx @@ -0,0 +1,40 @@ +import { Textarea, TextLabel } from '@morak/ui'; + +import * as styles from './index.css'; + +type TextareaProps = React.TextareaHTMLAttributes & { + label?: string; + errorMessage?: string; + fullWidth?: boolean; +}; + +export function FormTextarea({ + label = '', + errorMessage = '', + fullWidth = false, + ...rest +}: TextareaProps) { + const { value, maxLength, required } = rest; + + return ( +
+ {label && ( +
+ + {maxLength && ( + + {value?.toString()?.length || 0}/{maxLength} + + )} +
+ )} +