From 14561d6a881ce131f7fd49a55df4a5bf1860b9a1 Mon Sep 17 00:00:00 2001 From: KimChungO Date: Sun, 4 Aug 2024 16:22:47 +0900 Subject: [PATCH] =?UTF-8?q?[Update]GamePage=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20&=20=EC=88=98=EC=A0=95=20CSS=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/atoms/StarSelect.jsx | 76 ++++++++++++------------- src/components/molecules/Comment.js | 23 +++++--- src/components/molecules/CommentForm.js | 19 +++++-- src/components/organisms/CommentList.js | 2 + src/pages/GamePage.js | 1 + 5 files changed, 68 insertions(+), 53 deletions(-) diff --git a/src/components/atoms/StarSelect.jsx b/src/components/atoms/StarSelect.jsx index 5e5b446..56e86ff 100644 --- a/src/components/atoms/StarSelect.jsx +++ b/src/components/atoms/StarSelect.jsx @@ -4,9 +4,10 @@ import styled from "styled-components"; const StarStyle = styled.ul` display: flex; align-items: center; - gap: 20px; + gap: 10px; list-style-type: none; padding: 0; + margin: 0; li { cursor: pointer; &.active { @@ -14,6 +15,9 @@ const StarStyle = styled.ul` color: #ffcc00; } } + i { + font-size: 30px; + } } `; @@ -21,64 +25,54 @@ const StarSelect = ({ setSort, sort }) => { return (
  • 0 ? "active" : null} onClick={() => setSort(1)} > - - - - - + {sort > 0 ? ( + + ) : ( + + )}
  • 1 ? "active" : null} onClick={() => setSort(2)} > - - - - - + {sort > 1 ? ( + + ) : ( + + )}
  • 2 ? "active" : null} onClick={() => setSort(3)} > - - - - - + {sort > 2 ? ( + + ) : ( + + )}
  • 3 ? "active" : null} onClick={() => setSort(4)} > - - - - - + {sort > 3 ? ( + + ) : ( + + )}
  • 4 ? "active" : null} onClick={() => setSort(5)} > - - - - - + {sort > 4 ? ( + + ) : ( + + )}
  • ); diff --git a/src/components/molecules/Comment.js b/src/components/molecules/Comment.js index 6a4ee39..93c20e5 100644 --- a/src/components/molecules/Comment.js +++ b/src/components/molecules/Comment.js @@ -76,10 +76,17 @@ const CommentBox = styled.div` } `; -const Comment = ({ item, styled, reviewsubmit, reviewEdit, setReviewEdit }) => { +const Comment = ({ + item, + styled, + reviewsubmit, + reviewEdit, + setReviewEdit, + setSort, + sort, +}) => { const [ishelpful, setIshelpful] = useState(); const [clicked, setClicked] = useState(false); - const star = Math.floor(item.star); const IsEdit = () => { if (reviewEdit === true) { @@ -137,27 +144,27 @@ const Comment = ({ item, styled, reviewsubmit, reviewEdit, setReviewEdit }) => { ) : null}

    - {star >= 1 ? ( + {item.star >= 1 ? ( ) : ( )} - {star >= 2 ? ( + {item.star >= 2 ? ( ) : ( )} - {star >= 3 ? ( + {item.star >= 3 ? ( ) : ( )} - {star >= 4 ? ( + {item.star >= 4 ? ( ) : ( )} - {star === 5 ? ( + {item.star >= 5 ? ( ) : ( @@ -196,6 +203,8 @@ const Comment = ({ item, styled, reviewsubmit, reviewEdit, setReviewEdit }) => { reviewsubmit={reviewsubmit} reviewEdit={reviewEdit} setReviewEdit={setReviewEdit} + sort={sort} + setSort={setSort} /> ) : null} diff --git a/src/components/molecules/CommentForm.js b/src/components/molecules/CommentForm.js index 31e19ec..63effbb 100644 --- a/src/components/molecules/CommentForm.js +++ b/src/components/molecules/CommentForm.js @@ -15,11 +15,15 @@ const CommentFormBox = styled.div` form { display: flex; } - .buttonBox { + .submitBox { width: 100%; display: flex; justify-content: space-between; } + .buttonBox { + display: flex; + gap: 20px; + } .editBox { width: 100%; display: flex; @@ -36,11 +40,13 @@ const CommentForm = ({ sort, type, IsEdit, + star, }) => { const [reviewText, setreviewText] = useState(""); const submit = () => { reviewsubmit(reviewText); }; + return ( {type ? ( -

    - - +
    + +
    + + +
    ) : ( -
    +
    diff --git a/src/components/organisms/CommentList.js b/src/components/organisms/CommentList.js index ad6b7d6..ea9fdd8 100644 --- a/src/components/organisms/CommentList.js +++ b/src/components/organisms/CommentList.js @@ -48,6 +48,8 @@ const CommentList = ({ reviewsubmit={reviewsubmit} reviewEdit={reviewEdit} setReviewEdit={setReviewEdit} + setSort={setStar} + sort={star} /> )} { if (reviewEdit === true) { const data = await putReview(myReview.reviewId, { reviewContent: reviewText, + star: star, }); if (data.status === 200) { alert("리뷰 수정 완료");