From 25fdeb8523a2270757bc9434c3e9d8e220887c18 Mon Sep 17 00:00:00 2001 From: novice1993 Date: Thu, 7 Sep 2023 17:36:00 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20=EC=98=A4=EB=A5=98=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 커뮤니티 컴포넌트 관련 코드 오류 존재하여 수정 후 커밋 * 해당 컴포넌트 작성 담당자와 합의 마친 후 수정함 Issues #14 --- .../communityComponents/Comments.tsx | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/client/src/components/communityComponents/Comments.tsx b/client/src/components/communityComponents/Comments.tsx index 223c5b1e..779693e8 100644 --- a/client/src/components/communityComponents/Comments.tsx +++ b/client/src/components/communityComponents/Comments.tsx @@ -30,10 +30,7 @@ const Comments = ({ postId }: { postId: number }) => { setCommentData((prevCommentData) => [...prevCommentData, newCommentData]); // 게시물 ID에 따라 로컬 스토리지에 댓글 데이터를 저장합니다. - localStorage.setItem( - `commentData_${postId}`, - JSON.stringify([...commentData, newCommentData]) - ); + localStorage.setItem(`commentData_${postId}`, JSON.stringify([...commentData, newCommentData])); // 댓글 입력창 초기화 setCommentsValue(""); @@ -48,20 +45,17 @@ const Comments = ({ postId }: { postId: number }) => { setVisibleComments(close ? 1 : commentData.length); }; + const CommentText = { + write: "작성", + replyCount: `댓글${commentData.length}개 모두보기`, + }; + return (
- - handleClickSubmit()}> - {CommentText.write} - - - {CommentText.replyCount} - + + handleClickSubmit()}>{CommentText.write} + {CommentText.replyCount} {commentData.slice(0, visibleComments).map((el) => ( » {el.comments} ))} @@ -72,21 +66,18 @@ const Comments = ({ postId }: { postId: number }) => { export default Comments; -const CommentText = { - write: "작성", - replyCount: `댓글${commentData.length}개 모두보기`, -}; - const CommentInput = styled.input` border: 1px solid#40797c; outline: none; width: 280px; `; + const CommentInputSubmit = styled.button` outline: none; - border: 1px solid#40797; - background-color: #40797; + border: 1px solid #400797; + background-color: #400797; `; + const CommentContainer = styled.div` display: flex; justify-content: space-around;