/** * The count a rail item shows on its icon. Each badge is its own component so * the item's useBadge hook runs once per render of a stable element. */ export function RailBadge({ useBadge, variant = "count", className = "", }: { useBadge: () => number | null | undefined; variant?: "count" | "dot"; className?: string; }) { const count = useBadge(); if (!count || count <= 0) return null; if (variant === "dot") { return ( ); } return ( {count > 99 ? "99+" : count} ); }