import React from "react"; import Link from "next/link"; // headless ui import { Menu, Transition } from "@headlessui/react"; // ui import { DropdownProps } from "components/ui"; // icons import { ExpandMoreOutlined, MoreHorizOutlined } from "@mui/icons-material"; export type CustomMenuProps = DropdownProps & { children: React.ReactNode; ellipsis?: boolean; noBorder?: boolean; verticalEllipsis?: boolean; menuButtonOnClick?: (...args: any) => void; }; const CustomMenu = ({ buttonClassName = "", children, className = "", customButton, disabled = false, ellipsis = false, label, maxHeight = "md", noBorder = false, noChevron = false, optionsClassName = "", position = "right", selfPositioned = false, verticalEllipsis = false, verticalPosition = "bottom", width = "auto", menuButtonOnClick, }: CustomMenuProps) => ( {({ open }) => ( <> {customButton ? ( {customButton} ) : ( <> {ellipsis || verticalEllipsis ? ( ) : ( {label} {!noChevron && ( )} )}
{children}
)}
); type MenuItemProps = { children: React.ReactNode; renderAs?: "button" | "a"; href?: string; onClick?: (args?: any) => void; className?: string; }; const MenuItem: React.FC = ({ children, renderAs, href, onClick, className = "", }) => ( {({ active, close }) => renderAs === "a" ? ( {children} ) : ( ) } ); CustomMenu.MenuItem = MenuItem; export { CustomMenu };