import {useState} from 'react'; import DropdownAutoCompleteMenu from 'sentry/components/dropdownAutoComplete/menu'; import type {Item} from 'sentry/components/dropdownAutoComplete/types'; import Crumb from 'sentry/views/settings/components/settingsBreadcrumb/crumb'; import Divider from 'sentry/views/settings/components/settingsBreadcrumb/divider'; import type {RouteWithName} from './types'; interface AdditionalDropdownProps extends Pick< React.ComponentProps, 'onChange' | 'busyItemsStillVisible' > {} export interface BreadcrumbDropdownProps extends AdditionalDropdownProps { items: Item[]; name: React.ReactNode; onSelect: (item: Item) => void; route: RouteWithName; hasMenu?: boolean; isLast?: boolean; } function BreadcrumbDropdown({ hasMenu, route, isLast, name, onSelect, ...dropdownProps }: BreadcrumbDropdownProps) { const [isActive, setIsActive] = useState(false); return ( { setIsActive(false); onSelect(item); }} menuProps={{ onMouseEnter: () => setIsActive(true), onMouseLeave: () => setIsActive(false), }} {...dropdownProps} > {({getActorProps, isOpen}) => ( setIsActive(false), onMouseEnter: () => setIsActive(true), onMouseLeave: () => setIsActive(false), })} > {name || route.name} )} ); } export default BreadcrumbDropdown;