File size: 648 Bytes
89b98d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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>
  );
}