hide when rating btn is clicked

This commit is contained in:
Red Adaya 2024-11-20 13:13:43 +08:00
parent a43d32dcd6
commit 393a4ecfef

View File

@ -17,8 +17,9 @@ const RatingBubble = ({ notification, onRemove }: RatingBubbleProps) => {
const { id, title, message } = notification; const { id, title, message } = notification;
const [hoveredButtons, setHoveredButtons] = useState<{ [key: number]: boolean }>({}); const [hoveredButtons, setHoveredButtons] = useState<{ [key: number]: boolean }>({});
const handleRatingClick = (rating: number) => { const handleRatingClick = (id, rating: number) => {
console.log("rating clicked"); console.log("rating clicked");
onRemove(id);
}; };
const handleMouseEnter = (buttonIndex: number) => { const handleMouseEnter = (buttonIndex: number) => {
@ -49,7 +50,7 @@ const RatingBubble = ({ notification, onRemove }: RatingBubbleProps) => {
<Button <Button
key={rating} key={rating}
className={clsx("border-radius-4", hoveredButtons[rating] ? "green" : "grey")} className={clsx("border-radius-4", hoveredButtons[rating] ? "green" : "grey")}
onClick={() => handleRatingClick(rating)} onClick={() => handleRatingClick(id, rating)}
onMouseEnter={() => handleMouseEnter(rating)} onMouseEnter={() => handleMouseEnter(rating)}
onMouseLeave={() => handleMouseLeave(rating)} onMouseLeave={() => handleMouseLeave(rating)}
> >