You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
788 B
28 lines
788 B
import React, { useState } from "react"; |
|
import StarRatingComponent from "react-star-rating-component"; |
|
import starGrayIcon from '../../assets/icons/starGray.svg'; |
|
import starYellowIcon from '../../assets/icons/starYellow.svg'; |
|
|
|
function StarRating({value, size}) { |
|
const [rate, setRating] = useState(value); |
|
return ( |
|
<StarRatingComponent |
|
name="rate1" |
|
|
|
renderStarIcon={(index, value)=> { |
|
if (index <= value){ |
|
return ( |
|
<img src={starYellowIcon} className={size == 'small' ? 'w-3' : 'w-5'}/> |
|
); |
|
} |
|
return (<img src={starGrayIcon} className={size == 'small' ? 'w-3' : 'w-5'}/>); |
|
}} |
|
|
|
value={rate} |
|
size='35' |
|
// onStarHover={(value) => setRating(value)} |
|
/> |
|
); |
|
} |
|
|
|
export default StarRating;
|
|
|