import {useState} from 'react'; import DropdownAutoCompleteMenu from 'sentry/components/dropdownAutoComplete/menu'; import type {Item} from 'sentry/components/dropdownAutoComplete/types'; import Crumb from './crumb'; import Divider from './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;