'use client' import { useSelectedLayoutSegment } from 'next/navigation' import classNames from 'classnames' import Link from 'next/link' export type NavIcon = React.ComponentType< React.PropsWithoutRef> & { title?: string | undefined titleId?: string | undefined } > export type NavLinkProps = { name: string href: string iconMap: { selected: NavIcon normal: NavIcon } mode?: string } export default function NavLink({ name, href, iconMap, mode = 'expand', }: NavLinkProps) { const segment = useSelectedLayoutSegment() const formattedSegment = (() => { let res = segment?.toLowerCase() // logs and annotations use the same nav if (res === 'annotations') res = 'logs' return res })() const isActive = href.toLowerCase().split('/')?.pop() === formattedSegment const NavIcon = isActive ? iconMap.selected : iconMap.normal return (