diff --git a/README.md b/README.md
index dd02692..859832d 100644
--- a/README.md
+++ b/README.md
@@ -77,9 +77,9 @@ const Parent = () => {
return (
<>
-
바텀시트 컴포넌트
@@ -133,7 +133,7 @@ const carouselList = [0, 1, 2].map((index) => ({
-## **Checkbox**
+## Checkbox
체크박스 컴포넌트입니다.
@@ -338,9 +338,10 @@ import {Link as RouterLink, NavLink} from 'react-router-dom'
### Props
-| props | value | description |
-| ------- | ------------------------------------------------------ | ------------------------------------------------ |
-| resize? | both, horizontal, vertical, none
(default: both) | Textarea 컴포넌트의 크기 재조정 방향 설정입니다. |
+| props | value | description |
+| ------------- | ------------------------------------------------------ | ------------------------------------------------ |
+| resize? | both, horizontal, vertical, none
(default: both) | Textarea 컴포넌트의 크기 재조정 방향 설정입니다. |
+| errorMessage? | string | Textarea 컴포넌트의 에러 메시지입니다. |
### Example
@@ -348,3 +349,16 @@ import {Link as RouterLink, NavLink} from 'react-router-dom'
```
+
+## Toast
+
+알람을 띄우는 토스트 컴포넌트입니다.
+
+### Example
+
+```jsx
+const { toast } = useToastActionContext();
+
+toast.success('성공');
+toast.error('실패');
+```
diff --git a/src/BottomSheet/useBottomSheet.ts b/src/BottomSheet/useBottomSheet.ts
index c53f91f..de3f18a 100644
--- a/src/BottomSheet/useBottomSheet.ts
+++ b/src/BottomSheet/useBottomSheet.ts
@@ -1,4 +1,5 @@
-import { useCallback, useRef, useState } from 'react';
+import type { KeyboardEventHandler } from 'react';
+import { useCallback, useEffect, useRef, useState } from 'react';
export const useBottomSheet = () => {
const [isOpen, setIsOpen] = useState(false);
@@ -24,5 +25,18 @@ export const useBottomSheet = () => {
closeAnimated();
};
+ const handleKeydown = (e: KeyboardEvent) => {
+ if (e.keyCode === 27) {
+ e.preventDefault();
+ handleCloseBottomSheet();
+ }
+ };
+
+ useEffect(() => {
+ document.addEventListener('keydown', handleKeydown);
+
+ return () => document.removeEventListener('keydown', handleKeydown);
+ }, [handleKeydown]);
+
return { ref, isOpen, isClosing, handleOpenBottomSheet, handleCloseBottomSheet };
};
diff --git a/src/Textarea/Textarea.tsx b/src/Textarea/Textarea.tsx
index aab9b2f..cee1800 100644
--- a/src/Textarea/Textarea.tsx
+++ b/src/Textarea/Textarea.tsx
@@ -2,22 +2,44 @@ import { forwardRef } from 'react';
import type { CSSProperties, ComponentPropsWithRef } from 'react';
import styled from 'styled-components';
+import theme from '../styles/theme';
+import Text from '../Text/Text';
+
export interface TextareaProps extends ComponentPropsWithRef<'textarea'> {
/**
* Textarea 컴포넌트 사이즈 재조정 방향 설정입니다.
*/
resize?: CSSProperties['resize'];
+ /**
+ * Textarea 컴포넌트의 에러 메시지입니다.
+ */
+ errorMessage?: string;
}
-const Textarea = ({ resize = 'both', ref, ...props }: TextareaProps) => {
+const Textarea = ({ resize = 'both', errorMessage, ref, ...props }: TextareaProps) => {
return (
-
+ <>
+
+
+ {errorMessage}
+
+ >
);
};
export default forwardRef(Textarea);
-type TextareaStyleProps = Pick;
+type TextareaStyleProps = Pick & {
+ errorMessage?: string;
+};
const TextareaContainer = styled.textarea`
width: 100%;
@@ -27,7 +49,7 @@ const TextareaContainer = styled.textarea`
border-radius: 0;
line-height: 1.5;
resize: ${({ resize }) => resize};
- outline-color: ${({ theme }) => theme.colors.primary};
+ outline-color: ${({ errorMessage, theme }) => (errorMessage ? theme.colors.error : theme.colors.primary)};
&::placeholder {
color: ${({ theme }) => theme.textColors.disabled};
diff --git a/src/Toast/Toast.tsx b/src/Toast/Toast.tsx
index 96a6183..d1c42fa 100644
--- a/src/Toast/Toast.tsx
+++ b/src/Toast/Toast.tsx
@@ -16,7 +16,9 @@ const Toast = ({ id, message, isError = false }: ToastProps) => {
return (
- {message}
+
+ {message}
+
);
};