@@ -4,9 +4,10 @@ import Edit from '@mui/icons-material/Edit';
44import Box from '@mui/material/Box/Box' ;
55import Button from '@mui/material/Button/Button' ;
66import IconButton from '@mui/material/IconButton' ;
7+ import { useTheme } from '@mui/material/styles' ;
78import Tooltip from '@mui/material/Tooltip/Tooltip' ;
89import parseISO from 'date-fns/parseISO' ;
9- import { type MRT_ColumnDef , useMaterialReactTable } from 'material-react-table' ;
10+ import { type MRT_ColumnDef , type MRT_Theme , useMaterialReactTable } from 'material-react-table' ;
1011import React , { useCallback , useMemo , useState } from 'react' ;
1112
1213import DateTimeCell from 'apps/dashboard/components/table/DateTimeCell' ;
@@ -41,6 +42,7 @@ export const Component = () => {
4142 data ?. Items || [ ]
4243 ) , [ data ] ) ;
4344 const { usersById : users , names : userNames , isLoading : isUsersLoading } = useUsersDetails ( ) ;
45+ const theme = useTheme ( ) ;
4446
4547 const [ isDeleteConfirmOpen , setIsDeleteConfirmOpen ] = useState ( false ) ;
4648 const [ isDeleteAllConfirmOpen , setIsDeleteAllConfirmOpen ] = useState ( false ) ;
@@ -137,8 +139,15 @@ export const Component = () => {
137139 }
138140 ] , [ UserCell , userNames ] ) ;
139141
142+ // NOTE: We need to provide a custom theme due to a MRT bug causing the initial theme to always be used
143+ // https://github.com/KevinVandy/material-react-table/issues/1429
144+ const mrtTheme = useMemo < Partial < MRT_Theme > > ( ( ) => ( {
145+ baseBackgroundColor : theme . palette . background . paper
146+ } ) , [ theme ] ) ;
147+
140148 const mrTable = useMaterialReactTable ( {
141149 ...DEFAULT_TABLE_OPTIONS ,
150+ mrtTheme,
142151
143152 columns,
144153 data : devices ,
@@ -190,10 +199,18 @@ export const Component = () => {
190199 renderRowActions : ( { row, table } ) => {
191200 const isDeletable = api && row . original . Id && api . deviceInfo . id === row . original . Id ;
192201 return (
193- < Box sx = { { display : 'flex' , gap : 1 } } >
202+ < Box
203+ sx = { {
204+ display : 'flex' ,
205+ gap : 1 ,
206+ '&&' : {
207+ backgroundColor : 'transparent !important'
208+ }
209+ } }
210+ >
194211 < Tooltip title = { globalize . translate ( 'Edit' ) } >
195212 < IconButton
196- // eslint-disable-next-line react/jsx-no-bind
213+ // eslint-disable-next-line react/jsx-no-bind
197214 onClick = { ( ) => table . setEditingRow ( row ) }
198215 >
199216 < Edit />
0 commit comments