cde7be9f2a
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22 lines
554 B
TypeScript
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>
|
|
);
|
|
}
|