|
|
|
@ -3,7 +3,7 @@ import StarRatingComponent from "react-star-rating-component"; |
|
|
|
|
import starGrayIcon from '../../assets/icons/starGray.svg'; |
|
|
|
|
import starYellowIcon from '../../assets/icons/starYellow.svg'; |
|
|
|
|
|
|
|
|
|
function StarRating({value}) { |
|
|
|
|
function StarRating({value, size}) { |
|
|
|
|
const [rate, setRating] = useState(value); |
|
|
|
|
return ( |
|
|
|
|
<StarRatingComponent |
|
|
|
@ -12,15 +12,15 @@ function StarRating({value}) { |
|
|
|
|
renderStarIcon={(index, value)=> { |
|
|
|
|
if (index <= value){ |
|
|
|
|
return ( |
|
|
|
|
<img src={starYellowIcon} className="w-5"/> |
|
|
|
|
<img src={starYellowIcon} className={size == 'small' ? 'w-3' : 'w-5'}/> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return (<img src={starGrayIcon} className="w-5"/>); |
|
|
|
|
return (<img src={starGrayIcon} className={size == 'small' ? 'w-3' : 'w-5'}/>); |
|
|
|
|
}} |
|
|
|
|
|
|
|
|
|
value={rate} |
|
|
|
|
size='35' |
|
|
|
|
onStarHover={(value) => setRating(value)} |
|
|
|
|
// onStarHover={(value) => setRating(value)}
|
|
|
|
|
/> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|