import { Menu } from '@headlessui/react'; import classNames from 'classnames'; import type { MouseEvent, ReactNode, Ref } from 'react'; import { forwardRef } from 'react'; import type { NavLinkProps } from 'react-router-dom'; import { NavLink } from 'react-router-dom'; import styles from './style.module.css'; interface Props { children: ReactNode | ((opts: { active: boolean; disabled: boolean }) => JSX.Element); danger?: boolean; disabled?: boolean; className?: string; icon?: JSX.Element; onClick?: (e: MouseEvent) => void; } const DropdownItem = forwardRef>>( ({ disabled, danger, className, onClick, children, icon: IconComponent, ...props }, ref) => { return ( {({ disabled, active }) => ( <> {'to' in props && props.to !== undefined ? ( } className={classNames( styles.menu_item, { [styles.danger]: danger, [styles.disabled]: disabled, }, className, )} onClick={onClick} > {IconComponent} {typeof children === 'function' ? children({ disabled, active }) : children} ) : ( )} )} ); }, ); export { DropdownItem };