import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/app/_components/ui/select"

type YearSelectorProps = {
    years: number[]
    selectedYear: string
    onChange: (year: string) => void
    className?: string
}

export default function YearSelector({ years, selectedYear, onChange, className = "" }: YearSelectorProps) {
    return (
        <Select value={selectedYear} onValueChange={onChange}>
            <SelectTrigger className={`w-[180px] ${className}`}>
                <SelectValue placeholder="Select Year" />
            </SelectTrigger>
            <SelectContent>
                {years.map((year) => (
                    <SelectItem key={year} value={year.toString()}>
                        {year}
                    </SelectItem>
                ))}
            </SelectContent>
        </Select>
    )
}
