Files
MineGeo/components/SiteNav.tsx

32 lines
671 B
TypeScript

"use client";
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 pathname = usePathname();
return (
<nav aria-label="Main navigation">
{links.map(([href, label]) => (
<Link
key={href}
href={href}
aria-current={
pathname === href || pathname.startsWith(`${href}/`)
? "page"
: undefined
}
>
{label}
</Link>
))}
</nav>
);
}