Skip to content

Commit 7da3080

Browse files
refactor(core): refactor theme (#41)
1 parent 8903099 commit 7da3080

File tree

2 files changed

+51
-60
lines changed

2 files changed

+51
-60
lines changed

src/theme/theme.mui.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { SystemTokens } from './tokens.sys.ts';
2+
import { createTheme } from '@mui/material';
3+
4+
export const getMuiTheme = (st: SystemTokens, mode: 'dark' | 'light') =>
5+
createTheme({
6+
palette: {
7+
mode,
8+
primary: {
9+
main: st.colors.onContainer.contrast,
10+
},
11+
},
12+
typography: {
13+
fontSize: 12,
14+
},
15+
components: {
16+
MuiMenu: {
17+
styleOverrides: {
18+
list: {
19+
backgroundColor: st.colors.onContainer.dim,
20+
transition: st.transitions.color,
21+
},
22+
},
23+
},
24+
MuiSelect: {
25+
styleOverrides: {
26+
root: {
27+
'.MuiOutlinedInput-notchedOutline': {
28+
borderColor: st.colors.border,
29+
},
30+
transition: st.transitions.color,
31+
},
32+
},
33+
},
34+
MuiButton: {
35+
styleOverrides: {
36+
root: {
37+
transition: st.transitions.color,
38+
color: st.colors.onContainer.dim,
39+
},
40+
},
41+
},
42+
MuiInputLabel: {
43+
styleOverrides: {
44+
root: {
45+
color: st.colors.onContainer.contrast,
46+
},
47+
},
48+
},
49+
},
50+
});

src/theme/theme.ts

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,8 @@
11
import { SystemTokens } from './tokens.sys.ts';
2-
import { createTheme } from '@mui/material';
32
import { Theme } from '@emotion/react';
43
import { referenceTokens as ref } from './tokens.ref.ts';
54
import { getComponentsTokens } from './tokens.com.ts';
6-
7-
export const getMuiTheme = (st: SystemTokens, mode: 'dark' | 'light') =>
8-
createTheme({
9-
palette: {
10-
mode,
11-
primary: {
12-
main: st.colors.onContainer.contrast,
13-
},
14-
},
15-
typography: {
16-
fontSize: 12,
17-
},
18-
components: {
19-
MuiTooltip: {
20-
styleOverrides: {
21-
tooltip: {
22-
fontSize: '14',
23-
color: st.colors.onContainer.contrast,
24-
backgroundColor: st.colors.onContainer.dim,
25-
transition: st.transitions.color,
26-
},
27-
},
28-
},
29-
MuiMenu: {
30-
styleOverrides: {
31-
list: {
32-
backgroundColor: st.colors.onContainer.dim,
33-
transition: st.transitions.color,
34-
},
35-
},
36-
},
37-
MuiSelect: {
38-
styleOverrides: {
39-
root: {
40-
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
41-
borderColor: st.colors.onContainer.contrast,
42-
},
43-
transition: st.transitions.color,
44-
},
45-
},
46-
},
47-
MuiButton: {
48-
styleOverrides: {
49-
root: {
50-
transition: st.transitions.color,
51-
},
52-
},
53-
},
54-
MuiInputLabel: {
55-
styleOverrides: {
56-
root: {
57-
'&.Mui-focused': {
58-
color: st.colors.onContainer.contrast,
59-
},
60-
},
61-
},
62-
},
63-
},
64-
});
5+
import { getMuiTheme } from './theme.mui.ts';
656

667
export const getTheme = (sys: SystemTokens, mode: 'dark' | 'light'): Theme => {
678
return {

0 commit comments

Comments
 (0)