import type {
MenuDividerProps as MantineMenuDividerProps,
MenuDropdownProps as MantineMenuDropdownProps,
MenuItemProps as MantineMenuItemProps,
MenuLabelProps as MantineMenuLabelProps,
MenuProps as MantineMenuProps,
} from '@mantine/core';
import { Menu as MantineMenu } from '@mantine/core';
import clsx from 'clsx';
import { ReactNode } from 'react';
import styles from './dropdown-menu.module.css';
import { createPolymorphicComponent } from '/@/shared/utils/create-polymorphic-component';
type MenuDividerProps = MantineMenuDividerProps;
type MenuDropdownProps = MantineMenuDropdownProps;
interface MenuItemProps extends MantineMenuItemProps {
children: ReactNode;
isDanger?: boolean;
isSelected?: boolean;
}
type MenuLabelProps = MantineMenuLabelProps;
type MenuProps = MantineMenuProps;
export const DropdownMenu = ({ children, ...props }: MenuProps) => {
return (
{children}
);
};
const MenuLabel = ({ children, ...props }: MenuLabelProps) => {
return (
{children}
);
};
const pMenuItem = ({ children, isDanger, isSelected, ...props }: MenuItemProps) => {
return (
{children}
);
};
const MenuDropdown = ({ children, ...props }: MenuDropdownProps) => {
return (
{children}
);
};
const MenuItem = createPolymorphicComponent<'button', MenuItemProps>(pMenuItem);
const MenuDivider = ({ ...props }: MenuDividerProps) => {
return (
);
};
DropdownMenu.Label = MenuLabel;
DropdownMenu.Item = MenuItem;
DropdownMenu.Target = MantineMenu.Target;
DropdownMenu.Dropdown = MenuDropdown;
DropdownMenu.Divider = MenuDivider;