35 lines
760 B
TypeScript
35 lines
760 B
TypeScript
"use client";
|
|
import { useI18n } from "@/components/I18nProvider";
|
|
|
|
import Link from "next/link";
|
|
import { usePathname } from "next/navigation";
|
|
|
|
const links = [
|
|
["/servers", "Play & maps"],
|
|
["/leaderboard", "Leaderboard"],
|
|
["/downloads", "Downloads"],
|
|
["/about", "Guide"],
|
|
] as const;
|
|
|
|
export function SiteNav() {
|
|
const { t } = useI18n();
|
|
const pathname = usePathname();
|
|
return (
|
|
<nav aria-label={t("Main navigation")}>
|
|
{links.map(([href, label]) => (
|
|
<Link
|
|
key={href}
|
|
href={href}
|
|
aria-current={
|
|
pathname === href || pathname.startsWith(`${href}/`)
|
|
? "page"
|
|
: undefined
|
|
}
|
|
>
|
|
{t(label)}
|
|
</Link>
|
|
))}
|
|
</nav>
|
|
);
|
|
}
|