Files
biggus-dickus/web/src/shell/lang-switch.tsx
T
2026-06-07 14:15:54 +02:00

22 lines
554 B
TypeScript

import { useLocale } from "../i18n/use-locale";
export function LangSwitch() {
const { locale, setLocale } = useLocale();
const base = locale.startsWith("sv") ? "sv" : "en";
return (
<div className="flex gap-1 text-xs">
{(["sv", "en"] as const).map((lng) => (
<button
key={lng}
onClick={() => setLocale(lng)}
aria-pressed={base === lng}
className={base === lng ? "font-bold" : "text-muted-foreground"}
>
{lng.toUpperCase()}
</button>
))}
</div>
);
}