import clsx from 'clsx'; import type { HTMLAttributes, PropsWithChildren, ReactNode } from 'react'; import { forwardRef, useMemo } from 'react'; import { menuItemIcon } from './styles.css'; export interface MenuIconProps extends PropsWithChildren, HTMLAttributes { icon?: ReactNode; position?: 'start' | 'end'; } export const MenuIcon = forwardRef( ({ children, icon, position = 'start', className, ...otherProps }, ref) => { return (
clsx( menuItemIcon, { end: position === 'end', start: position === 'start', }, className ), [className, position] )} {...otherProps} > {icon || children}
); } ); MenuIcon.displayName = 'MenuIcon';