import { Link, useLocation } from 'react-router-dom' import type { LucideIcon } from 'lucide-react' import { cn } from '@/lib/utils' interface NavItemProps { href: string icon: LucideIcon label: string badge?: number | 'dot' matchPaths?: string[] collapsed?: boolean } export function NavItem({ href, icon: Icon, label, badge, matchPaths, collapsed }: NavItemProps) { const location = useLocation() const isActive = matchPaths ? matchPaths.some(p => location.pathname.startsWith(p)) : href === '/' ? location.pathname === '/' : location.pathname.startsWith(href) if (collapsed) { return ( {isActive && (
)} {badge !== undefined && badge !== 0 && badge !== 'dot' && ( {badge} )} ) } return ( {/* Active indicator bar */} {isActive && (
)} {label} {/* Badge */} {badge !== undefined && badge !== 0 && ( badge === 'dot' ? ( ) : ( {badge} ) )} ) }