import styled from '@emotion/styled'; import Menu from './menu'; type MenuProps = React.ComponentProps; type Props = { // Should clicking the actor toggle visibility allowActorToggle?: boolean; } & MenuProps; const DropdownAutoComplete = ({allowActorToggle = false, children, ...props}: Props) => ( {renderProps => { const {isOpen, actions, getActorProps} = renderProps; // Don't pass `onClick` from `getActorProps` const {onClick: _onClick, ...actorProps} = getActorProps(); return ( {children(renderProps)} ); }} ); const Actor = styled('div')<{isOpen: boolean}>` position: relative; width: 100%; /* This is needed to be able to cover dropdown menu so that it looks like one unit */ ${p => p.isOpen && `z-index: ${p.theme.zIndex.dropdownAutocomplete.actor}`}; `; export default DropdownAutoComplete;