Conversation
dalzzy
left a comment
There was a problem hiding this comment.
수고하셨습니당 깔끔하게 구현 잘 해주신 것 같아요!! 👍🏻
| interface StarRatingProps { | ||
| rating: number; | ||
| color?: 'white' | 'red'; | ||
| } | ||
|
|
||
| const StarRating = ({ rating }: StarRatingProps) => { | ||
| const StarRating = ({ rating, color = 'white' }: StarRatingProps) => { | ||
| const full = Math.floor(rating); | ||
| const half = rating % 1 >= 0.5; | ||
| const empty = 5 - full - (half ? 1 : 0); | ||
|
|
||
| const colorClass = color === 'red' ? 'fill-red-300 text-red-300' : 'fill-white text-white'; | ||
|
|
||
| return ( | ||
| <div className="flex gap-1"> | ||
| <div className="flex"> | ||
| {Array(full) | ||
| .fill(0) | ||
| .map((_, idx) => ( | ||
| <StarFill key={`full-${idx}`} className="h-6 w-6 fill-white text-white" /> | ||
| <StarFill key={`full-${idx}`} className={`h-6 w-6 ${colorClass}`} /> | ||
| ))} | ||
| {half && <StarHalf className="h-6 w-6 fill-white text-white" />} | ||
| {half && <StarHalf className={`h-6 w-6 ${colorClass}`} />} | ||
| {Array(empty) | ||
| .fill(0) | ||
| .map((_, idx) => ( | ||
| <StarLine key={`empty-${idx}`} className="h-6 w-6 stroke-white text-white" /> | ||
| <StarLine key={`empty-${idx}`} className={`h-6 w-6 ${colorClass}`} /> | ||
| ))} | ||
| </div> |
There was a problem hiding this comment.
svg에 fill="current"로 설정해서 색상을 props로 제어할 수 있게 해주신 부분 넘 좋네요! 👏👏
재사용성도 좋아지고 깔끔하게 잘 구현하신 것 같아요! 굿굿
src/pages/home/PopularReview.tsx
Outdated
| <Header | ||
| title="인기있는 후기" | ||
| showBack | ||
| showLike={false} | ||
| showBookmark={false} | ||
| onBackClick={() => navigate(-1)} | ||
| /> |
There was a problem hiding this comment.
이 부분은 pull 하고
<Header leftSection='BACK'>인기있는 후기</Header>
로 바꿔주셔야할 것 같습니당
src/pages/home/PopularReview.tsx
Outdated
| const navigate = useNavigate(); | ||
| const top10Reviews = getTopReviewByLikes(bestReviewMock, 10); | ||
| return ( | ||
| <div className="flex min-h-screen max-w-[430px] flex-col bg-gray-900 pt-11 pb-5 text-white"> |
There was a problem hiding this comment.
max-w-[430px],bg-gray-900, text-white 전부 이미 전역으로 설정되어 있는 스타일이라 삭제해주셔도 괜찮을 것 같습니다!
There was a problem hiding this comment.
해당 부분 포함된 파일 모두 수정했습니다!
src/pages/home/SeatReviewPage.tsx
Outdated
| <Header | ||
| title="" | ||
| showBack | ||
| onBackClick={() => navigate('')} | ||
| showBookmark={false} | ||
| showLike={false} | ||
| /> |
| <span className="text-title-2 text-white">{calculateAverageRating(filteredReviews)}</span> | ||
| <span className="text-title-2 text-gray-500">({filteredReviews.length})</span> |
There was a problem hiding this comment.
"reviewCount": 1,
"averageRating": 3.2,
스웨거에 리뷰갯수랑, 별점 평점 필드가 있어서 실제 api 연결할 때는 그냥 이 값으로 사용하면 될 것 같습니다!!
(아마 원래 빠진 부분이었는데 말씀드렸더니 백엔드에서 수정해주신 것 같습니다!)
There was a problem hiding this comment.
아 그렇군요! API 연결할 때 수정하겠습니다 감사합니당 <3<3
soyun-git121
left a comment
There was a problem hiding this comment.
코드 전체적으로 봤는데 리뷰상세페이지나 다른부분들도 다 깔끔하고 좋은거같아용 수고하셨습니다!!
🔍 관련된 이슈
📝 작업 내용
📸 스크린샷
🚨 이슈
📣 리뷰 요구사항
✅ 체크리스트