import { MouseEventHandler } from 'react'; import { MenuItemStyle } from './MenuItem.styles'; import { Spinner } from '../Spinner/Spinner'; import { Box } from '../Box/Box'; import { Text } from '../Text/Text'; export type MenuItemProps = { id?: string; icon?: any; style?: any; loading?: boolean; tabIndex?: number; label: string; disabled?: boolean; selected?: boolean; section?: number; color?: string; customBg?: string; onClick: MouseEventHandler; }; export const MenuItem = ({ id, icon, label, style, disabled, onClick, selected, customBg, color, tabIndex, loading = false, }: MenuItemProps) => { let innerContent; if (loading) { innerContent = ; } else { innerContent = ( <> {icon && {icon}} {label} ); } return ( { if (!disabled) { onClick(evt); } else { evt.preventDefault(); evt.stopPropagation(); } }} > {innerContent} ); };