Skip to content

Commit 816419e

Browse files
Seoje1405bk-git-hub
authored andcommitted
refactor: 리뷰 별점 생성 컴포넌트 수정 및 크기 조정 #40
1 parent 995e06b commit 816419e

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/components/product/review/review-item.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export function ReviewItem({ review, isAccessory = false }: ReviewItemProps) {
4646
<Image
4747
src="/icons/smile.svg"
4848
alt="smile-icon"
49-
width={20}
50-
height={20}
49+
width={30}
50+
height={30}
5151
/>
52-
<StarRating rating={review.rating} size={20} />
52+
<StarRating rating={review.rating} size={30} />
5353
<span className="pt-0.5 text-base leading-none font-bold text-gray-900">
5454
{review.rating}
5555
</span>

src/components/ui/star-rating.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import { StarHalf } from 'lucide-react';
3+
import { StarHalf, Star } from 'lucide-react'; // 빈 별 표현을 위해 Star 아이콘 추가
44
import { cn } from '@/lib/utils';
55
import Image from 'next/image';
66

@@ -16,11 +16,14 @@ interface StarRatingProps {
1616
export function StarRating({
1717
rating,
1818
max = 5,
19-
size = 20,
19+
size,
2020
className,
2121
}: StarRatingProps) {
2222
return (
23-
<div className={cn('flex items-center gap-2', className)}>
23+
<div
24+
className={cn('flex items-center gap-2', className)}
25+
aria-label={`${max}점 만점에 ${rating}점`}
26+
>
2427
{Array.from({ length: max }).map((_, i) => {
2528
const index = i + 1;
2629
if (rating >= index) {
@@ -37,14 +40,17 @@ export function StarRating({
3740
// 추후 피그마에 반별 아이콘 업로드시 교체 예정
3841
if (rating >= index - 0.5) {
3942
return (
40-
<StarHalf key={i} size={size} className="fill-yellow text-black" />
43+
<StarHalf
44+
key={i}
45+
size={size}
46+
className="fill-yellow-400 text-yellow-400"
47+
/>
4148
);
4249
}
43-
4450
return (
4551
<Image
4652
key={i}
47-
src="/icons/star.svg"
53+
src="/icons/star-gray.svg"
4854
alt="star-full"
4955
width={size}
5056
height={size}

0 commit comments

Comments
 (0)