import MenuItem , { MenuItemProps } from "@material-ui/core/MenuItem" ; import React from "react" ; import { useUserChipMenu } from "./context" ; export interface UserChipMenuItemProps extends Omit < MenuItemProps , "button" > { leaveOpen ? : boolean ; } export const UserChipMenuItem = ( { leaveOpen , onClick , ... props } ) => { const closeMenu = useUserChipMenu ( ) ; const handleClickWithClose = ( event ) => { closeMenu ( ) ; if ( onClick ) { onClick ( event as any ) ; } } ; return ( < MenuItem { ... props } onClick = { leaveOpen ? onClick : handleClickWithClose } button / > ) ; } ; UserChipMenuItem . displayName = "UserChipMenuItem" ;