import { ReactNode } from 'react'; import Box from './Box'; import styles from './Dropdown.css'; import Text from './Text'; import TextUI from './TextUI'; import useExperimentalTheme from './utils/useExperimentalTheme'; type Props = { /** * Any [Dropdown.Items](https://gestalt.pinterest.systems/web/dropdown#Dropdown.ItemProps) and/or [Dropdown.Links](https://gestalt.pinterest.systems/web/dropdown#Dropdown.LinkProps) to be rendered */ children: ReactNode; /** * Label for the section. See the [Sections](https://gestalt.pinterest.systems/web/dropdown#Sections) variant for more info. */ label: string; }; /** * Use [Dropdown.Section](https://gestalt.pinterest.systems/web/dropdown#Dropdown.Section) to create hierarchy within a single Dropdown. */ export default function DropdownSection({ label, children }: Props) { const theme = useExperimentalTheme(); return (
{theme.MAIN ? ( {label} ) : ( {label} )} {children}
); } // displayName is necessary for children identification in Dropdown DropdownSection.displayName = 'Dropdown.Section';