spb/phi-conseil
Public
1"use client";23import Link from "next/link";4import { usePathname } from "next/navigation";56type Item = { label: string; href: string };78export function NavLinks({9 items,10 className = "",11 onNavigate,12 vertical = false,13}: {14 items: Item[];15 className?: string;16 onNavigate?: () => void;17 vertical?: boolean;18}) {19 const pathname = usePathname();20 return (21 <ul className={className}>22 {items.map((item) => {23 const active = item.href === "/" ? pathname === "/" : pathname.startsWith(item.href);24 return (25 <li key={item.href}>26 <Link27 href={item.href}28 onClick={onNavigate}29 aria-current={active ? "page" : undefined}30 className={31 vertical32 ? `text-navy-900 hover:bg-navy-900/5 block rounded-md px-3 py-3 font-serif text-2xl ${33 active ? "decoration-gold-500 underline underline-offset-8" : ""34 }`35 : `text-ink-700 hover:text-navy-900 after:bg-navy-900 relative block py-1 text-[0.85rem] whitespace-nowrap transition-colors after:absolute after:inset-x-0 after:-bottom-1 after:h-px after:origin-left after:scale-x-0 after:transition-transform after:duration-[var(--duration-base)] hover:after:scale-x-100 ${36 active ? "text-navy-900 after:scale-x-100" : ""37 }`38 }39 >40 {item.label}41 </Link>42 </li>43 );44 })}45 </ul>46 );47}48