import { FC, memo, useRef } from 'react' import { Button, ListGroup, Overlay, Popover } from 'react-bootstrap' import Icon from '../../../../shared/components/icon' import useDropdown from '../../../../shared/hooks/use-dropdown' import Tooltip from '../../../../shared/components/tooltip' export const ToolbarButtonMenu: FC<{ id: string label: string icon: string }> = memo(function ButtonMenu({ icon, id, label, children }) { const target = useRef(null) const { open, onToggle, ref } = useDropdown() const button = ( ) const overlay = ( onToggle(false)} > { onToggle(false) }} > {children} ) if (!label) { return ( <> {button} {overlay} ) } return ( <> {label}} overlayProps={{ placement: 'bottom' }} > {button} {overlay} ) })