Skip to content

Commit 17b4a72

Browse files
authored
Merge pull request #862 from amitamrutiya/update-table-theme
update mui table theme
2 parents 9b8c44a + 915bf12 commit 17b4a72

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

src/custom/ResponsiveDataTable.tsx

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,29 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
126126
typography: {
127127
fontFamily: theme.typography.fontFamily
128128
},
129+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
130+
//@ts-ignore
131+
palette: {
132+
text: {
133+
primary: theme.palette.text.default,
134+
secondary: theme.palette.text.secondary
135+
},
136+
background: {
137+
default: backgroundColor || theme.palette.background.constant?.table,
138+
paper: backgroundColor || theme.palette.background.constant?.table
139+
}
140+
},
129141
components: {
142+
MuiTableCell: {
143+
styleOverrides: {
144+
root: {
145+
borderBottom: `1px solid ${theme.palette.border.default}`
146+
}
147+
}
148+
},
130149
MuiPaper: {
131150
styleOverrides: {
132151
root: {
133-
background: backgroundColor || theme.palette.background.default,
134152
maxWidth: '-moz-available'
135153
}
136154
}
@@ -141,24 +159,19 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
141159
width: '-webkit-fill-available',
142160
'@media (max-width: 500px)': {
143161
wordWrap: 'break-word'
144-
},
145-
background: backgroundColor || theme.palette.background.constant?.table,
146-
color: theme.palette.text.default
162+
}
147163
}
148164
}
149165
},
150166
MUIDataTableHeadCell: {
151167
styleOverrides: {
152168
data: {
153169
fontWeight: 'bold',
154-
textTransform: 'uppercase',
155-
color: theme.palette.text.default
170+
textTransform: 'uppercase'
156171
},
157172
root: {
158173
fontWeight: 'bold',
159-
textTransform: 'uppercase',
160-
color: theme.palette.text.default,
161-
backgroundColor: backgroundColor || theme.palette.background.constant?.table
174+
textTransform: 'uppercase'
162175
}
163176
}
164177
},
@@ -177,7 +190,6 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
177190
intermediate: false,
178191
color: 'transparent',
179192
'&.Mui-checked': {
180-
color: theme.palette.text.default,
181193
'& .MuiSvgIcon-root': {
182194
width: '1.25rem',
183195
height: '1.25rem',
@@ -207,30 +219,6 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
207219
}
208220
}
209221
},
210-
MuiTableCell: {
211-
styleOverrides: {
212-
body: {
213-
color: theme.palette.text.default
214-
},
215-
root: {
216-
borderBottom: `1px solid ${theme.palette.border.default}`
217-
}
218-
}
219-
},
220-
MUIDataTablePagination: {
221-
styleOverrides: {
222-
toolbar: {
223-
color: theme.palette.text.default
224-
}
225-
}
226-
},
227-
MUIDataTableSelectCell: {
228-
styleOverrides: {
229-
headerCell: {
230-
background: backgroundColor || theme.palette.background.constant?.table
231-
}
232-
}
233-
},
234222
MuiInput: {
235223
styleOverrides: {
236224
root: {

0 commit comments

Comments
 (0)