-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kiranwankhade
committed
May 13, 2023
1 parent
444835c
commit 1112e85
Showing
18 changed files
with
778 additions
and
75 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react"; | ||
|
||
const Star = ({ marked, starId }) => { | ||
return ( | ||
<span data-star-id={starId} className="star" > | ||
{marked ? '\u2605' : '\u2606'} | ||
</span> | ||
); | ||
}; | ||
const StarRatings = ({ value }) =>{ | ||
|
||
const [rating, setRating] = React.useState(parseInt(value) || 0); | ||
const [selection, setSelection] = React.useState(0); | ||
|
||
// const hoverOver = event => { | ||
// let val = 0; | ||
// if (event && event.target && event.target.getAttribute('data-star-id')) | ||
// val = event.target.getAttribute('data-star-id'); | ||
// setSelection(val); | ||
// }; | ||
return ( | ||
<div> | ||
{Array.from({ length: 5 }, (v, i) => ( | ||
<Star | ||
starId={i + 1} | ||
key={`star_${i + 1}`} | ||
marked={selection ? selection >= i + 1 : rating >= i + 1} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default StarRatings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.