* Section header row: collapse-toggle on the left + optional (i) * disclosure on the right that expands the section's `description` * prose inline below the row, pushing items down. * * Why inline rather than a floating popover: the nav uses * `overflow-y: auto` for scrolling, which clips horiz
({
label,
description,
isCollapsed,
onToggleCollapse,
controlsId,
showItems,
}: {
label: string
description?: string
isCollapsed: boolean
onToggleCollapse: () => void
controlsId: string
showItems: boolean
})
| 344 | * preference worth persisting. |
| 345 | */ |
| 346 | function SectionHeader({ |
| 347 | label, |
| 348 | description, |
| 349 | isCollapsed, |
| 350 | onToggleCollapse, |
| 351 | controlsId, |
| 352 | showItems, |
| 353 | }: { |
| 354 | label: string |
| 355 | description?: string |
| 356 | isCollapsed: boolean |
| 357 | onToggleCollapse: () => void |
| 358 | controlsId: string |
| 359 | showItems: boolean |
| 360 | }) { |
| 361 | const { t } = useTranslation() |
| 362 | const [hintOpen, setHintOpen] = useState(false) |
| 363 | return ( |
| 364 | <> |
| 365 | <div className="flex items-center px-3 mb-1"> |
| 366 | <button |
| 367 | type="button" |
| 368 | onClick={onToggleCollapse} |
| 369 | className="flex-1 flex min-h-7 items-center gap-1.5 py-1 text-[12px] font-semibold text-text-muted/75 hover:text-text-muted transition-colors text-left" |
| 370 | aria-expanded={!isCollapsed} |
| 371 | aria-controls={controlsId} |
| 372 | title={label} |
| 373 | > |
| 374 | <ChevronDown |
| 375 | size={12} |
| 376 | strokeWidth={2.25} |
| 377 | className={`shrink-0 transition-transform duration-150 ${ |
| 378 | isCollapsed ? '-rotate-90' : 'rotate-0' |
| 379 | }`} |
| 380 | aria-hidden |
| 381 | /> |
| 382 | <span>{label}</span> |
| 383 | </button> |
| 384 | {description && ( |
| 385 | <button |
| 386 | type="button" |
| 387 | onClick={() => setHintOpen((o) => !o)} |
| 388 | className={`flex min-h-7 min-w-7 items-center justify-center p-0.5 transition-colors ${ |
| 389 | hintOpen ? 'text-text-muted' : 'text-text-muted/50 hover:text-text-muted' |
| 390 | }`} |
| 391 | aria-label={t('nav.about', { label })} |
| 392 | aria-expanded={hintOpen} |
| 393 | > |
| 394 | <Info size={11} strokeWidth={2.25} aria-hidden /> |
| 395 | </button> |
| 396 | )} |
| 397 | </div> |
| 398 | {showItems && description && hintOpen && ( |
| 399 | <p className="px-3 mb-2 text-[11px] text-text-muted/60 leading-relaxed"> |
| 400 | {description} |
| 401 | </p> |
| 402 | )} |
| 403 | </> |
nothing calls this directly
no outgoing calls
no test coverage detected