"use client"; import React, { useState } from "react"; interface RatingProps { label: string; onRate: (rating: number) => void; } const Rating: React.FC = ({ label, onRate }) => { const [selected, setSelected] = useState(0); const handleClick = (rating: number) => { setSelected(rating); onRate(rating); }; return (
{label}
{[1, 2, 3, 4, 5].map((star) => ( ))}
); }; const FeedbackForm: React.FC = () => { const [ratings, setRatings] = useState({ accessibility: 0, appearance: 0, content: 0, }); const handleRatingChange = (field: keyof typeof ratings, value: number) => { setRatings((prev) => ({ ...prev, [field]: value })); }; const handleSubmit = () => { console.log("Feedback submitted:", ratings); alert("Terima kasih atas feedback Anda!"); }; return (
Feedback

Feedback Pengguna

handleRatingChange("accessibility", rating)} /> handleRatingChange("appearance", rating)} /> handleRatingChange("content", rating)} />
); }; export default FeedbackForm;