Skip to content

Commit 81edba8

Browse files
committed
[RTT-05] feature/MUI-Setup-global-style
1 parent 3cf037e commit 81edba8

File tree

5 files changed

+77
-37
lines changed

5 files changed

+77
-37
lines changed

src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { debounce } from '@mui/material';
1+
import { debounce, Typography } from '@mui/material';
22
import { useEffect, useReducer, useState } from 'react';
33
import services from './api/index';
44
import './App.css';
@@ -48,6 +48,7 @@ function App() {
4848

4949
return (
5050
<div className="App">
51+
<Typography variant="h3">Hello word</Typography>
5152
<div className={`wrapper ${isSuccess && 'active'}`}>
5253
<header>
5354
<i className="bx bx-left-arrow-alt" onClick={() => setIsSuccess(false)}></i>Weather App
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @style CssBaseLine,
3+
* @description Style for global,
4+
* @link docs : https://mui.com/material-ui/react-css-baseline/#main-content
5+
*/
6+
export default {
7+
primary: {
8+
main: '#81c784',
9+
contrastText: '#000000',
10+
},
11+
secondary: {
12+
main: '#ffb74d',
13+
contrastText: '#000',
14+
},
15+
info: {
16+
main: '#0277bd',
17+
contrastText: '#FFFFFF',
18+
},
19+
success: {
20+
main: '#2e7d32',
21+
contrastText: '#FFFFFF',
22+
},
23+
warning: {
24+
main: '#f9a825',
25+
contrastText: '#FFFFFF',
26+
},
27+
error: {
28+
main: '#c62828',
29+
contrastText: '#FFFFFF',
30+
},
31+
32+
text: {
33+
primary: 'white',
34+
},
35+
} as const;

src/assets/style/base/global.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Theme } from '@mui/material';
2+
3+
/**
4+
* @style CssBaseLine,
5+
* @description Style for global,
6+
* @link docs : https://mui.com/material-ui/react-css-baseline/#main-content
7+
*/
8+
export default {
9+
styleOverrides: (themeParam: Theme) => `
10+
:root{
11+
--mui-header-height: 3.875rem;
12+
--mui-footer-height: 14.5rem;
13+
}
14+
15+
body{
16+
background-color: ${themeParam.palette.secondary.contrastText}
17+
}
18+
19+
.content-default-layout{
20+
min-height: calc(100vh - (var(--mui-header-height) + var(--mui-footer-height)))
21+
}
22+
`,
23+
} as const;

src/assets/style/base/typography.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @style typography,
3+
* @description Style for typography,
4+
* @link docs : https://mui.com/material-ui/react-typography/#main-content
5+
*/
6+
export default {
7+
htmlFontSize: 16,
8+
fontSize: 12,
9+
} as const;

src/mui-config.tsx

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,18 @@
1-
import { createTheme, ThemeProvider, StyledEngineProvider, CssBaseline, Theme } from '@mui/material/';
1+
//Github https://github.com/karpolan/react-mui-pro-starter/tree/main/src/components
22

3-
const FRONT_COLORS = {
4-
primary: {
5-
main: '#81c784',
6-
contrastText: '#000000',
7-
},
8-
secondary: {
9-
main: '#ffb74d',
10-
contrastText: '#000',
11-
},
12-
info: {
13-
main: '#0277bd',
14-
contrastText: '#FFFFFF',
15-
},
16-
success: {
17-
main: '#2e7d32',
18-
contrastText: '#FFFFFF',
19-
},
20-
warning: {
21-
main: '#f9a825',
22-
contrastText: '#FFFFFF',
23-
},
24-
error: {
25-
main: '#c62828',
26-
contrastText: '#FFFFFF',
27-
},
28-
};
3+
import { createTheme, ThemeProvider, StyledEngineProvider, CssBaseline } from '@mui/material/';
4+
import global from './assets/style/base/global';
5+
import typography from './assets/style/base/typography';
6+
import variables from './assets/style/abstracts/variables';
297

308
const DEFAULT_THEME = {
319
palette: {
32-
...FRONT_COLORS,
10+
...variables,
3311
},
12+
typography,
3413
components: {
3514
MuiCssBaseline: {
36-
styleOverrides: (themeParam: Theme) => `
37-
h1 {
38-
color: ${themeParam.palette.success.main};
39-
},
40-
body{
41-
background-color: ${themeParam.palette.secondary.contrastText}
42-
}
43-
`,
15+
...global,
4416
},
4517
},
4618
};

0 commit comments

Comments
 (0)