1
- import { Theme , ThemeProvider , createTheme , styled } from '@mui/material' ;
1
+ import { Theme , ThemeProvider , createTheme , styled , useTheme } from '@mui/material' ;
2
2
import MUIDataTable from 'mui-datatables' ;
3
3
import React , { useCallback } from 'react' ;
4
- import { Menu , MenuItem } from '../base' ;
4
+ import { ListItemIcon , ListItemText , Menu , MenuItem } from '../base' ;
5
5
import { EllipsisIcon } from '../icons/Ellipsis' ;
6
6
import TooltipIcon from './TooltipIcon' ;
7
7
@@ -14,11 +14,6 @@ export const IconWrapper = styled('div')<{ disabled?: boolean }>(({ disabled = f
14
14
}
15
15
} ) ) ;
16
16
17
- const CustomMenuItem = styled ( MenuItem ) ( ( ) => ( {
18
- paddingLeft : '0px' ,
19
- padding : '10px'
20
- } ) ) ;
21
-
22
17
export const DataTableEllipsisMenu : React . FC < {
23
18
actionsList : NonNullable < Column [ 'options' ] > [ 'actionsList' ] ;
24
19
} > = ( { actionsList } ) => {
@@ -30,26 +25,34 @@ export const DataTableEllipsisMenu: React.FC<{
30
25
setAnchorEl ( null ) ;
31
26
} ;
32
27
28
+ const theme = useTheme ( ) ;
29
+
33
30
return (
34
31
< >
35
32
< TooltipIcon title = "View Actions" onClick = { handleClick } icon = { < EllipsisIcon /> } arrow />
36
33
< Menu
34
+ id = "basic-menu"
37
35
anchorEl = { anchorEl }
38
36
open = { Boolean ( anchorEl ) }
39
37
onClose = { handleClose }
40
- PaperProps = { {
41
- style : {
42
- maxHeight : 48 * 4.5
38
+ sx = { {
39
+ ' .MuiPaper-root' : {
40
+ background : theme . palette . background . surfaces
43
41
}
44
42
} }
45
43
>
46
44
{ actionsList &&
47
45
actionsList . map ( ( action , index ) => (
48
46
< 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 >
53
56
</ IconWrapper >
54
57
) ) }
55
58
</ Menu >
0 commit comments