Skip to content

Commit 35966c3

Browse files
authored
[Tech] Clean up MUI theming (#4803)
Clean up MUI theming We can use MUI's own theming functionality to set the font family & colors to use once. Doing it like this means MUI components will look right everywhere There are probably more rules that can be removed now. I wasn't sure on how to test most of them, so I just left them alone
1 parent 2b84229 commit 35966c3

File tree

6 files changed

+11
-25
lines changed

6 files changed

+11
-25
lines changed

src/frontend/App.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,18 @@ function Root() {
3131

3232
const theme = createTheme({
3333
direction: isRTL ? 'rtl' : 'ltr',
34+
typography: {
35+
fontFamily: 'var(--primary-font-family)'
36+
},
3437
components: {
38+
MuiPaper: {
39+
styleOverrides: {
40+
root: {
41+
color: 'var(--text-default)',
42+
backgroundColor: 'var(--background)'
43+
}
44+
}
45+
},
3546
MuiTooltip: {
3647
styleOverrides: {
3748
tooltip: {

src/frontend/components/UI/Dialog/components/Dialog.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ interface DialogProps {
2525

2626
const StyledPaper = styled(Paper)(() => ({
2727
backgroundColor: 'var(--modal-background)',
28-
color: 'var(--text-default)',
2928
maxWidth: '100%',
3029
'&:has(.settingsDialogContent):not(:has(.logs-wrapper))': {
3130
height: '80%'

src/frontend/components/UI/Dialog/components/DialogHeader.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const DialogHeader: React.FC<DialogHeaderProps> = ({ children }) => {
1010
return (
1111
<DialogTitle
1212
sx={{
13-
fontFamily: 'var(--primary-font-family)',
1413
fontSize: 'var(--text-xl)',
1514
fontWeight: 'var(--bold)',
1615
paddingLeft: 0

src/frontend/components/UI/SelectField/index.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
width: 100%;
1111
height: 40px;
1212
background: var(--input-background);
13-
font-family: var(--primary-font-family), 'Noto Color Emoji';
1413
font-weight: normal;
1514
font-size: var(--text-md);
1615
color: var(--text-secondary);
@@ -42,10 +41,6 @@
4241
.MuiPopover-root .MuiPaper-root {
4342
color: var(--text-secondary);
4443
background-color: var(--input-background);
45-
46-
.MuiMenuItem-root {
47-
font-family: var(--primary-font-family);
48-
}
4944
}
5045

5146
.selectStyle {

src/frontend/screens/Library/components/ContextMenu/index.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
border-radius: 10px;
99
}
1010

11-
.contextMenu > .MuiPaper-root > .MuiMenu-list > .MuiMenuItem-root {
12-
font-family: var(--primary-font-family);
13-
}
14-
1511
.contextMenu > .MuiPaper-root > .MuiMenu-list > .MuiMenuItem-root:hover {
1612
text-decoration: none;
1713
background-color: var(--navbar-active-background);

src/frontend/screens/Settings/sections/SystemInfo/index.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
.systeminfo {
2-
hr {
3-
width: 100%;
4-
background-color: var(--text-default);
5-
}
6-
72
.logo {
83
height: 100%;
94
zoom: 2;
@@ -19,15 +14,6 @@
1914
}
2015
}
2116

22-
.MuiPaper-root {
23-
color: var(--text-default);
24-
background-color: var(--background);
25-
}
26-
27-
.MuiTypography-root {
28-
font-family: var(--primary-font-family);
29-
}
30-
3117
.MuiLinearProgress-bar {
3218
background-color: var(--success);
3319
}

0 commit comments

Comments
 (0)