From 3914deb3ad2bca663fc4a6a3faaeb3ce64ac675b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Tue, 23 Jan 2024 15:07:20 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20=EB=A6=AC=EB=B7=B0=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1,=20=ED=97=A4=EB=8D=94=20=EC=8A=A4=ED=83=80=EC=9D=BC?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Review/ReviewButton.tsx | 43 +++---------------- src/components/Review/ReviewPosting.tsx | 2 +- src/components/Review/ReviewRating.tsx | 4 +- src/components/common/header/DetailHeader.tsx | 4 +- src/components/common/header/ReviewHeader.tsx | 6 +-- 5 files changed, 15 insertions(+), 44 deletions(-) diff --git a/src/components/Review/ReviewButton.tsx b/src/components/Review/ReviewButton.tsx index ca1209a5..11885da3 100644 --- a/src/components/Review/ReviewButton.tsx +++ b/src/components/Review/ReviewButton.tsx @@ -1,7 +1,7 @@ import { ButtonPrimary } from '@components/common/button/Button'; -import { useState, useEffect } from 'react'; -import { contentState, keywordsState, ratingState } from '@recoil/review'; -import { useRecoilState, useRecoilValue } from 'recoil'; +import { ratingState } from '@recoil/review'; +import { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; interface ButtonProps { onClick: () => void; @@ -9,29 +9,9 @@ interface ButtonProps { const ReviewButton = (props: ButtonProps) => { const { onClick } = props; - const [content] = useRecoilState(contentState); - const keywords = useRecoilValue(keywordsState); const rating = useRecoilValue(ratingState); - const [isContentValid, setIsContentValid] = useState(false); - const [isKeywordsValid, setIsKeywordsValid] = useState(false); const [isRatingValid, setIsRatingValid] = useState(false); - useEffect(() => { - if (content.length >= 10) { - setIsContentValid(true); - } else if (content.length < 10) { - setIsContentValid(false); - } - }, [content]); - - useEffect(() => { - if (keywords.length > 0) { - setIsKeywordsValid(true); - } else if (keywords.length <= 0) { - setIsKeywordsValid(false); - } - }, [keywords]); - useEffect(() => { if (rating > 0) { setIsRatingValid(true); @@ -41,28 +21,19 @@ const ReviewButton = (props: ButtonProps) => { }, [rating]); return ( -
- {isRatingValid === false && ( -
- 별점을 입력해주세요 -
- )} - - {isRatingValid === true && +
+ {/* {isRatingValid === true && isContentValid === false && isKeywordsValid === false && (
키워드를 선택하거나 텍스트를 10자 이상 입력해주세요
- )} + )} */} + disabled={isRatingValid === false}> 완료
diff --git a/src/components/Review/ReviewPosting.tsx b/src/components/Review/ReviewPosting.tsx index e266e39d..215e164a 100644 --- a/src/components/Review/ReviewPosting.tsx +++ b/src/components/Review/ReviewPosting.tsx @@ -17,7 +17,7 @@ export default function ReviewPosting() {
리뷰를 작성해주세요