import { useI18n } from "@/lib/i18n"; import { LOCALE_OPTIONS } from "@/lib/i18n/messages"; import { COLORS } from "@/lib/design-tokens"; /** ธงชาติไทยย่อส่วน */ function FlagTh() { return ( ); } /** ธงสหราชอาณาจักรย่อส่วน */ function FlagEn() { return ( ); } const FLAGS = { th: FlagTh, en: FlagEn } as const; /** * สลับภาษาเป็นปุ่มสองปุ่ม (TH / EN) — ไม่มีเมนูให้เปิด/ปิด * จึงไม่มีปัญหาคลิกพลาดหรือเมนูถูกบัง และกดครั้งเดียวเปลี่ยนทันที */ export function LocaleSwitcher() { const { locale, setLocale } = useI18n(); return (
{LOCALE_OPTIONS.map((option) => { const Flag = FLAGS[option.locale]; const isActive = option.locale === locale; return ( ); })}
); }