From d82b4f40ef0fe24b0fbc824c28d58fa7dd83cc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9A=B0=EC=84=B1?= Date: Thu, 8 Feb 2024 00:40:19 +0900 Subject: [PATCH] =?UTF-8?q?[FE]=20Feat=20#133:=20=EB=8C=93=EA=B8=80=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EB=B3=B4=EC=9D=BC=20=EB=95=8C=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=20=EC=9E=85=EB=A0=A5=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EB=9E=9C=EB=8D=94=EB=A7=81=20=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I25ef17876ba0016799d4d4e3c74da84f1f3d4dd0 --- .../BucketDetail/Comment/CommentInput.tsx | 25 ++++++++-- .../BucketDetail/Comment/CommentList.tsx | 46 +++++++++++++++++-- .../src/pages/Bucket/BucketDetail/index.tsx | 7 ++- 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/Bucket/BucketDetail/Comment/CommentInput.tsx b/frontend/src/pages/Bucket/BucketDetail/Comment/CommentInput.tsx index f57a5f08..a2f40c96 100644 --- a/frontend/src/pages/Bucket/BucketDetail/Comment/CommentInput.tsx +++ b/frontend/src/pages/Bucket/BucketDetail/Comment/CommentInput.tsx @@ -1,20 +1,37 @@ -import { ChangeEvent, useState } from 'react' +import { ChangeEvent, useRef } from 'react' +import { useCommentStore } from '../../../../store/detailStore' + +interface ICommentInput { + setIsInputFocused: React.Dispatch> +} + +// Todo: Pwa 환경에서 해당 컴포넌트가 언마운트 될때 키보드가 내려가는지 확인 필요 +const CommentInput = ({ setIsInputFocused }: ICommentInput) => { + const { commentText, setCommentText } = useCommentStore() + const inputRef = useRef(null) -const CommentInput = () => { - const [commentText, setCommentText] = useState('') const handleCommentChange = (event: ChangeEvent) => { const text = event.currentTarget.value setCommentText(text) } + const handleFocusInput = () => { + setIsInputFocused(true) + } + const handleBlurInput = () => { + setIsInputFocused(false) + } return ( -
+
- + - + {isInputShown && } ) }