import { Menu, MenuItem, SubMenu } from '@szhsin/react-menu';
import { cloneElement } from 'preact';
function MenuConfirm({
subMenu = false,
confirm = true,
confirmLabel,
menuItemClassName,
menuFooter,
...props
}) {
const { children, onClick, ...restProps } = props;
if (!confirm) {
if (subMenu) return ;
if (onClick) {
return cloneElement(children, {
onClick,
});
}
return children;
}
const Parent = subMenu ? SubMenu : Menu;
return (
{menuFooter}
);
}
export default MenuConfirm;