'use client'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { CONTACT_LINKS, cn } from '$shared/lib'; import type { NavItem } from '../model/types'; /** * Props for SidebarNav. */ interface Props { /** * Navigation items to render */ items: NavItem[]; } /** * Fixed sidebar navigation, visible on lg+ screens. * Active section determined by current URL pathname. */ export function SidebarNav({ items }: Props) { const pathname = usePathname(); /** * An item is active when its slug matches the current pathname, * or when the pathname is root and it is the first item. */ function isActive(item: NavItem): boolean { if (pathname === `/${item.id}`) { return true; } if (pathname === '/' && items[0]?.id === item.id) { return true; } return false; } return ( ); }