From 536fcb6ed563511d074c6a2881f807968efb3e59 Mon Sep 17 00:00:00 2001 From: mango906 Date: Fri, 11 Feb 2022 01:34:09 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Feat:=20Textarea=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/Textarea/Textarea.component.tsx | 27 ++++++++ .../common/Textarea/Textarea.stories.tsx | 18 +++++ .../common/Textarea/Textarea.styled.ts | 65 +++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 src/components/common/Textarea/Textarea.component.tsx create mode 100644 src/components/common/Textarea/Textarea.stories.tsx create mode 100644 src/components/common/Textarea/Textarea.styled.ts diff --git a/src/components/common/Textarea/Textarea.component.tsx b/src/components/common/Textarea/Textarea.component.tsx new file mode 100644 index 00000000..09b84017 --- /dev/null +++ b/src/components/common/Textarea/Textarea.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import * as Styled from './Textarea.styled'; + +export interface TextareaProps extends React.InputHTMLAttributes { + id: string; + label: string; + errorMessage?: string; +} + +const Textarea = ({ id, required, label, errorMessage, ...restProps }: TextareaProps) => { + return ( + + + {label} + {required && } + + + {errorMessage && {errorMessage}} + + ); +}; + +export default Textarea; + +Textarea.defaultProps = { + errorMessage: '', +}; diff --git a/src/components/common/Textarea/Textarea.stories.tsx b/src/components/common/Textarea/Textarea.stories.tsx new file mode 100644 index 00000000..844d0ffb --- /dev/null +++ b/src/components/common/Textarea/Textarea.stories.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import { ComponentStory, ComponentMeta } from '@storybook/react'; +import Textarea, { TextareaProps } from './Textarea.component'; + +export default { + title: 'Textarea', + component: Textarea, +} as ComponentMeta; + +const Template: ComponentStory = (args: TextareaProps) =>