1- import { Theme , ThemeProvider , createTheme , styled } from '@mui/material' ;
1+ import { Theme , ThemeProvider , createTheme , styled , useTheme } from '@mui/material' ;
22import MUIDataTable from 'mui-datatables' ;
33import React , { useCallback } from 'react' ;
4- import { Menu , MenuItem } from '../base' ;
4+ import { ListItemIcon , ListItemText , Menu , MenuItem } from '../base' ;
55import { EllipsisIcon } from '../icons/Ellipsis' ;
66import TooltipIcon from './TooltipIcon' ;
77
@@ -14,11 +14,6 @@ export const IconWrapper = styled('div')<{ disabled?: boolean }>(({ disabled = f
1414 }
1515} ) ) ;
1616
17- const CustomMenuItem = styled ( MenuItem ) ( ( ) => ( {
18- paddingLeft : '0px' ,
19- padding : '10px'
20- } ) ) ;
21-
2217export const DataTableEllipsisMenu : React . FC < {
2318 actionsList : NonNullable < Column [ 'options' ] > [ 'actionsList' ] ;
2419} > = ( { actionsList } ) => {
@@ -30,26 +25,34 @@ export const DataTableEllipsisMenu: React.FC<{
3025 setAnchorEl ( null ) ;
3126 } ;
3227
28+ const theme = useTheme ( ) ;
29+
3330 return (
3431 < >
3532 < TooltipIcon title = "View Actions" onClick = { handleClick } icon = { < EllipsisIcon /> } arrow />
3633 < Menu
34+ id = "basic-menu"
3735 anchorEl = { anchorEl }
3836 open = { Boolean ( anchorEl ) }
3937 onClose = { handleClose }
40- PaperProps = { {
41- style : {
42- maxHeight : 48 * 4.5
38+ sx = { {
39+ ' .MuiPaper-root' : {
40+ background : theme . palette . background . surfaces
4341 }
4442 } }
4543 >
4644 { actionsList &&
4745 actionsList . map ( ( action , index ) => (
4846 < IconWrapper key = { index } disabled = { action . disabled } >
49- < CustomMenuItem key = { index } onClick = { action . onClick } disabled = { action . disabled } >
50- { action . icon }
51- { action . title }
52- </ CustomMenuItem >
47+ < MenuItem
48+ sx = { { width : '-webkit-fill-available' } }
49+ key = { index }
50+ onClick = { action . onClick }
51+ disabled = { action . disabled }
52+ >
53+ < ListItemIcon > { action . icon } </ ListItemIcon >
54+ < ListItemText > { action . title } </ ListItemText >
55+ </ MenuItem >
5356 </ IconWrapper >
5457 ) ) }
5558 </ Menu >
0 commit comments