alpha01 filetti: web app, crossword service and tor batch
This commit is contained in:
29
webapp/components/language-switcher.tsx
Normal file
29
webapp/components/language-switcher.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import Link from "next/link";
|
||||
import { LOCALES, type Locale } from "@/lib/i18n";
|
||||
|
||||
type LanguageSwitcherProps = {
|
||||
locale: Locale;
|
||||
path?: string;
|
||||
};
|
||||
|
||||
const LABELS: Record<Locale, string> = {
|
||||
it: "Italiano",
|
||||
en: "English",
|
||||
es: "Espanol",
|
||||
};
|
||||
|
||||
export function LanguageSwitcher({ locale, path = "" }: LanguageSwitcherProps) {
|
||||
return (
|
||||
<nav aria-label="Language switcher" className="lang-switcher">
|
||||
{LOCALES.map((item) => (
|
||||
<Link
|
||||
className={`lang-switcher__link ${item === locale ? "lang-switcher__link--active" : ""}`}
|
||||
href={`/${item}${path}`}
|
||||
key={item}
|
||||
>
|
||||
{LABELS[item]}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user