import { PropsWithChildren, ReactNode } from 'react'; import { useSidebarState } from './useSidebarState'; interface Props { title: ReactNode; showTitleWhenOpen?: boolean; 'aria-label'?: string; } export function SidebarSection({ title, children, showTitleWhenOpen, 'aria-label': ariaLabel, }: PropsWithChildren) { return (
{title}
); } interface TitleProps { showWhenOpen?: boolean; } export function SidebarSectionTitle({ showWhenOpen, children, }: PropsWithChildren) { const { isOpen } = useSidebarState(); if (!isOpen && !showWhenOpen) { return null; } return (
  • {children}
  • ); }