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