From 6b01bf957a7d15a68cc10c7325981f7ab6518779 Mon Sep 17 00:00:00 2001 From: KangSan Lee Date: Sun, 8 Oct 2023 16:56:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EC=A0=9C=EC=95=88=20?= =?UTF-8?q?=EB=A9=94=EC=84=B8=EC=A7=80=20=EB=AA=A8=EB=8B=AC=20=EA=B8=80?= =?UTF-8?q?=EC=9E=90=EC=88=98=20=EC=98=A4=EB=A5=98=20(#616)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: sendMessageModal에서 message state를 가지도록 변경 * fix: 리뷰 제안 후 모달 닫기 --- frontend/package-lock.json | 4 +-- .../SendMessageModal/SendMessageModal.tsx | 27 ++++++++++--------- frontend/src/components/Textarea/Textarea.tsx | 3 ++- frontend/src/pages/RunnerPostDetailPage.tsx | 15 +++-------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 31e43a7a6..7d0c07a80 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "baton", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "baton", - "version": "1.1.0", + "version": "1.1.1", "license": "ISC", "dependencies": { "@types/react": "^18.2.14", diff --git a/frontend/src/components/SendMessageModal/SendMessageModal.tsx b/frontend/src/components/SendMessageModal/SendMessageModal.tsx index 764b27705..41ef5955f 100644 --- a/frontend/src/components/SendMessageModal/SendMessageModal.tsx +++ b/frontend/src/components/SendMessageModal/SendMessageModal.tsx @@ -1,25 +1,26 @@ -import React from 'react'; +import React, { useState } from 'react'; import { styled } from 'styled-components'; import Button from '../common/Button/Button'; import TextArea from '../Textarea/Textarea'; import useViewport from '@/hooks/useViewport'; interface Props { - messageState: string; - handleChangeMessage: (e: React.ChangeEvent) => void; placeholder: string; closeModal: () => void; - handleClickSendButton: () => void; + sendMessage: (message: string) => void; } -const SendMessageModal = ({ - messageState, - handleChangeMessage, - placeholder, - closeModal, - handleClickSendButton, -}: Props) => { +const SendMessageModal = ({ placeholder, closeModal, sendMessage }: Props) => { const { isMobile } = useViewport(); + const [message, setMessage] = useState(''); + + const handleChangeInput = (e: React.ChangeEvent) => { + setMessage(e.target.value); + }; + + const handleClickSendButton = () => { + sendMessage(message); + }; return ( @@ -31,8 +32,8 @@ const SendMessageModal = ({ maxLength={500} padding="0" placeholder={placeholder} - handleInputTextState={handleChangeMessage} - inputTextState={messageState} + handleInputTextState={handleChangeInput} + inputTextState={message} />