import classNames from 'classnames'; import React, { useRef } from 'react'; import { useClickAway } from 'react-use'; interface Props { isOpen: boolean; pull?: 'left' | 'right' | 'center'; style?: 'default' | 'outline'; onClickAway: () => void; center?: boolean; offsetX?: number; offsetY?: number; // Use DropdownItem children?: JSX.Element | JSX.Element[]; } export function Dropdown(props: Props) { // Ensure children are all DropdownItems const { isOpen, pull = 'right', style = 'default', center = false, offsetX, offsetY, onClickAway, children, } = props; const ref = useRef(null); useClickAway(ref, onClickAway); return (
{children}
); }