import { Star } from "lucide-react"; import { cn } from "@/lib/utils"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; interface StarRatingProps { value: number; onChange?: (v: number) => void; readonly?: boolean; size?: "sm" | "md"; } export function StarRating({ value, onChange, readonly = false, size = "md", }: StarRatingProps) { const iconClass = size === "sm" ? "h-3.5 w-3.5" : "h-5 w-5"; const stars = ( {[1, 2, 3, 4, 5].map((star) => { const filled = star <= value; return ( ); })} ); if (readonly) { return ( {stars} {value} out of 5 stars ); } return stars; }