๐ŸŽ‰ berenickt ๋ธ”๋กœ๊ทธ์— ์˜จ ๊ฑธ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. ๐ŸŽ‰
Front
UI ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
Material UI

1. Material UI

  • https://m3.material.io/
    • ๊ตฌ๊ธ€์ด 2014๋…„ ์•ˆ๋“œ๋กœ์ด๋“œ ์Šค๋งˆํŠธํฐ์— ์ ์šฉํ•˜๋ฉด์„œ ์•Œ๋ ค์ง
    • ๊ตฌ๊ธ€์ด ์„ ๋„ํ•˜๋Š” ๋””์ž์ธ ์‹œ์Šคํ…œ์ด๋ผ ์—…๋ฐ์ดํŠธ๊ฐ€ ์ž์ฃผ ์ด๋ฃจ์–ด์ง€๊ณ  ์ฒด๊ณ„์ ์ž„
  • https://mui.com/core/
  • ๊ฐ์ข… ํ…Œ๋งˆ๋“ค

2. ์˜ˆ์ œ 1 : ๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ•

1
npm install @mui/material @emotion/react @emotion/styled # ๊ธฐ๋ณธ ์„ค์น˜
2
npm install @mui/icons-material # Icons

2.1 index.html

index.html์— ๋‹ค์Œ link ํƒœ๊ทธ ์ถ”๊ฐ€

1
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
2
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />

2.2 App.js

1
// Webpack CSS import
2
// import 'onsenui/css/onsenui.css';
3
// import 'onsenui/css/onsen-css-components.css';
4
// import OnesenUIExample from './components/OnsenUI/OnesenUIExample';
5
// import AntDesignExample from './components/AntDesign/AntDesignExample';
6
// import 'semantic-ui-css/semantic.min.css';
7
// import ReactSemanticUIExample from './components/ReactSemanticUI/ReactSemanticUIExample';
8
// import 'bootstrap/dist/css/bootstrap.min.css';
9
// import ReactBootstrapExample from './components/ReactBootstrap/ReactBootstrapExample';
10
import MaterialUIExample from './components/MaterialUI/MaterialUIExample'
11
12
export default function App() {
13
return (
14
<>
15
<MaterialUIExample />
16
{/* <ReactBootstrapExample /> */}
17
{/* <ReactSemanticUIExample /> */}
18
{/* <AntDesignExample /> */}
19
{/* <OnesenUIExample /> */}
20
</>
21
)
22
}

2.3 ButtonExample

1
import Button from '@mui/material/Button'
2
3
export default function ButtonExample() {
4
return <Button variant="contained">Hello World</Button>
5
}

2.4 MaterialUIExample

1
import ButtonExample from './ButtonExample'
2
3
export default function MaterialUIExample() {
4
return (
5
<div>
6
<ButtonExample />
7
</div>
8
)
9
}

3. ๊ณต์‹ ์‚ฌ์ดํŠธ CRA ์˜ˆ์ œ

  • https://github.com/mui/material-ui/tree/master/examples/create-react-app
  • ์œ„ Github๋ฅผ clone(๋ณต์ œ)ํ•˜๊ฑฐ๋‚˜ Zip์œผ๋กœ ๋‹ค์šด๋ฐ›์•„ ๋งŒ๋“ค์–ด๋†“์€ ์˜ˆ์ œ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.
  • ์•„๋‹ˆ๋ฉด ๊ณต์‹ ์‚ฌ์ดํŠธ์— ์˜ˆ์ œ๋ณ„๋กœ Code SandBox๊ฐ€ ์ž˜ ๋˜์–ด ์žˆ๋‹ค.

4. ์˜ˆ์ œ3 : Grid

1
import * as React from 'react'
2
import { styled } from '@mui/material/styles'
3
import Box from '@mui/material/Box'
4
import Paper from '@mui/material/Paper'
5
import Grid from '@mui/material/Grid'
6
7
const Item = styled(Paper)(({ theme }) => ({
8
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff',
9
...theme.typography.body2,
10
padding: theme.spacing(1),
11
textAlign: 'center',
12
color: theme.palette.text.secondary,
13
}))
14
15
export default function BasicGrid() {
16
return (
17
<Box sx={{ flexGrow: 1 }}>
18
<Grid container spacing={2}>
19
<Grid item xs={8}>
20
<Item>xs=8</Item>
21
</Grid>
22
<Grid item xs={4}>
23
<Item>xs=4</Item>
24
</Grid>
25
<Grid item xs={4}>
26
<Item>xs=4</Item>
27
</Grid>
28
<Grid item xs={8}>
29
<Item>xs=8</Item>
30
</Grid>
31
</Grid>
32
</Box>
33
)
34
}

MaterialUIExample์— ์ถ”๊ฐ€