-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStars.js
More file actions
22 lines (18 loc) · 973 Bytes
/
Stars.js
File metadata and controls
22 lines (18 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"use client";
import { motion } from "framer-motion";
import importedStyles from "./Stars.module.css";
export default function Stars(props) {
const disabled = props.disabled;
const selectedStars = props.selectedStars;
const setSelectedStars = props.setSelectedStars;
const starCount = props.starCount;
const style = props.style;
const styles = props.styles || importedStyles;
return (
<div className={styles.stars + (disabled ? " " + styles.stars_disabled : "")} style={style}>
{new Array(starCount).fill(false).map((star, starIndex) => (
<motion.span aria-hidden className={"fa fa-star fa-2x " + styles.star + (starIndex < selectedStars ? " " + styles.star_selected : "")} key={"star-" + starIndex} onClick={disabled ? undefined : (e) => setSelectedStars(starIndex + 1)} transition={disabled ? undefined : { type: "spring", stiffness: 500 }} whileHover={disabled ? undefined : { scale: 1.2 }}></motion.span>
))}
</div>
);
}