1
- import { Theme , styled } from '@mui/material/styles' ;
2
1
import MUIDataTable , { MUIDataTableColumn } from 'mui-datatables' ;
3
2
import React , { useCallback } from 'react' ;
4
3
import { Checkbox , Collapse , ListItemIcon , ListItemText , Menu , MenuItem } from '../base' ;
5
4
import { ShareIcon } from '../icons' ;
6
5
import { EllipsisIcon } from '../icons/Ellipsis' ;
6
+ import { styled , useTheme } from './../theme' ;
7
7
import { ColView } from './Helpers/ResponsiveColumns/responsive-coulmns.tsx' ;
8
8
import { TooltipIcon } from './TooltipIconButton' ;
9
9
@@ -20,11 +20,10 @@ export const IconWrapper = styled('div', {
20
20
21
21
export const DataTableEllipsisMenu : React . FC < {
22
22
actionsList : NonNullable < Column [ 'options' ] > [ 'actionsList' ] ;
23
- theme ?: Theme ;
24
- } > = ( { actionsList, theme } ) => {
23
+ } > = ( { actionsList } ) => {
25
24
const [ anchorEl , setAnchorEl ] = React . useState < null | HTMLElement > ( null ) ;
26
25
const [ isSocialShareOpen , setIsSocialShareOpen ] = React . useState ( false ) ;
27
-
26
+ const theme = useTheme ( ) ;
28
27
const handleClick = ( event : React . MouseEvent < HTMLElement > ) => {
29
28
setAnchorEl ( event . currentTarget ) ;
30
29
} ;
@@ -50,7 +49,7 @@ export const DataTableEllipsisMenu: React.FC<{
50
49
< TooltipIcon
51
50
title = "View Actions"
52
51
onClick = { handleClick }
53
- icon = { < EllipsisIcon fill = { theme ? .palette . icon . default ?? 'black' } /> }
52
+ icon = { < EllipsisIcon fill = { theme . palette . icon . default } /> }
54
53
arrow
55
54
/>
56
55
< Menu
@@ -59,9 +58,8 @@ export const DataTableEllipsisMenu: React.FC<{
59
58
open = { Boolean ( anchorEl ) }
60
59
onClose = { handleClose }
61
60
sx = { {
62
- fontFamily : theme ?. typography . fontFamily ,
63
61
'& .MuiPaper-root' : {
64
- backgroundColor : theme ? .palette . background . card ?? 'white'
62
+ backgroundColor : theme . palette . background . card
65
63
}
66
64
} }
67
65
>
@@ -73,19 +71,14 @@ export const DataTableEllipsisMenu: React.FC<{
73
71
key = { `${ index } -menuitem` }
74
72
sx = { {
75
73
width : '-webkit-fill-available'
76
- // background: theme.palette.background.surfaces
77
74
} }
78
75
onClick = { ( ) => handleActionClick ( action ) }
79
76
disabled = { action . disabled }
80
77
>
81
78
< ListItemIcon >
82
- < ShareIcon
83
- width = { 24 }
84
- height = { 24 }
85
- fill = { theme ?. palette . text . primary ?? 'black' }
86
- />
79
+ < ShareIcon width = { 24 } height = { 24 } fill = { theme . palette . text . primary } />
87
80
</ ListItemIcon >
88
- < ListItemText sx = { { color : theme ? .palette . text . primary ?? 'black' } } >
81
+ < ListItemText sx = { { color : theme . palette . text . primary } } >
89
82
{ action . title }
90
83
</ ListItemText >
91
84
</ MenuItem > ,
@@ -109,7 +102,7 @@ export const DataTableEllipsisMenu: React.FC<{
109
102
disabled = { action . disabled }
110
103
>
111
104
< ListItemIcon > { action . icon } </ ListItemIcon >
112
- < ListItemText sx = { { color : theme ? .palette . text . primary ?? 'black' } } >
105
+ < ListItemText sx = { { color : theme . palette . text . primary } } >
113
106
{ action . title }
114
107
</ ListItemText >
115
108
</ MenuItem >
0 commit comments