'use client';

import { useLocale } from '@/layout/Providers/IntlProvider';
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from '@/components/ui/select';

export default function LocaleSwitch() {
  const { locale, setLocale } = useLocale();

  return (
    <Select value={locale} onValueChange={(value) => setLocale(value as 'zh-CN' | 'en-US')}>
      <SelectTrigger className="rounded-full h-8 w-16 px-3">
        <SelectValue />
      </SelectTrigger>
      <SelectContent className="min-w-0 w-22">
        <SelectItem value="zh-CN">中</SelectItem>
        <SelectItem value="en-US">En</SelectItem>
      </SelectContent>
    </Select>
  );
}
