Files
craftvia/src/components/nav-link.tsx
T
msolarczekandClaude Opus 5 c8e6f30a27
CI / build-and-check (push) Canceled after 0s
CI / audit (push) Canceled after 0s
CI / sbom (push) Canceled after 0s
Basis: Certvia dev@a48c5fb als Fundament für Craftvia
Unveränderter Stand von certvia/dev (a48c5fb) plus Craftvia-Spezifikation
und Brandbook unter docs/craftvia/. ISMS-Module werden im Folgecommit entfernt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 11:05:39 +02:00

35 lines
788 B
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { cn } from "@/lib/utils";
export function NavLink({
href,
match,
children,
}: {
href: string;
match?: string[];
children: React.ReactNode;
}) {
const pathname = usePathname();
const active = (match ?? [href]).some(
(m) => pathname === m || pathname.startsWith(m + "/")
);
return (
<Link
href={href}
className={cn(
"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13.5px] font-semibold transition-colors",
active
? "bg-sidebar-accent text-sidebar-accent-foreground [&_svg]:opacity-100"
: "text-sidebar-foreground hover:bg-secondary hover:text-foreground"
)}
>
{children}
</Link>
);
}