import { LANGS, useT } from "../lib/i18n";

export default function LanguageSwitcher() {
  const { lang, setLang } = useT();
  return (
    <div className="inline-flex overflow-hidden rounded-md border border-line">
      {LANGS.map((l) => (
        <button
          key={l.code}
          onClick={() => setLang(l.code)}
          className={`px-2.5 py-1 text-xs font-semibold transition ${
            lang === l.code
              ? "bg-gov-600 text-white"
              : "bg-white text-ink-soft hover:bg-paper"
          }`}
          aria-pressed={lang === l.code}
        >
          {l.label}
        </button>
      ))}
    </div>
  );
}
