import { useState } from 'react';
import { Star } from 'lucide-react';
interface StarRatingProps {
value: number;
onChange?: (rating: number) => void;
size?: number;
readonly?: boolean;
className?: string;
}
export function StarRating({
value,
onChange,
size = 20,
readonly = false,
className = '',
}: StarRatingProps) {
const [hover, setHover] = useState(0);
const interactive = !readonly && !!onChange;
return (
{[1, 2, 3, 4, 5].map((star) => {
const filled = (hover || value) >= star;
return (
);
})}
);
}
export default StarRating;