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>
  );
}
