"use client" import { cloneElement, memo, type ReactElement, type ReactNode } from 'react' import Link from '../../embed-shims/next-link' import { NavigationSidebarItem } from '../../types/navigation' import { cn } from '../../utils' import { UnreadDot } from './unread-dot' interface IconProps { color?: string className?: string } export interface NavigationSidebarItemButtonProps { item: NavigationSidebarItem /** "You are on this page" — pathname-derived, and the only thing that carries `aria-current`. */ isActive: boolean /** * "You clicked this one and it has not arrived yet" — deliberately a separate, * weaker state. Never promoted to active: the accent belongs to the page you * are actually on. */ isPending: boolean showLabel: boolean disabled: boolean onClick: (item: NavigationSidebarItem, event?: React.MouseEvent) => void } /** * One sidebar entry. * * Rendered as a real anchor whenever it has a `path` — which is what buys the * two things a ` ) } return ( onClick(item, event)} {...shared}> {content} ) }) /** * One placeholder entry, for `NavigationSidebarConfig.loading`. * * Deliberately in this file, beside `NavigationSidebarItemButton`: the two must * agree on `h-14`, the `p-[var(--spacing-system-m)]` inset, the 24px icon box and * the label column, or the nav resizes on the handoff. Same reason * `header-skeleton.tsx` sits beside `header.tsx`. * * `showLabel` is the sidebar's own minimized state, so the caller passes what it * already passes the real row — no separate width handling. */ export function NavigationSidebarItemSkeleton({ showLabel }: { showLabel: boolean }) { return (