https://mui.com/material-ui/react-progress/
Circular, Linear progress React components - Material UI
Progress indicators commonly known as spinners, express an unspecified wait time or display the length of a process.
mui.com
์งํ๋ฐ๋ฅผ ์ฌ์ฉํด์, ๋ ๋ฒจ๋ฐ๋ฅผ ๊ตฌํํ๊ฒ ์ต๋๋ค!
00. Linear progress
๋ณธ๋ชจ์ต์ ์๋ ์ด๋ ๊ฒ ์๊ฒผ์ต๋๋ค.
01. Linear progress Customization
mui์์ ๋์จ ๊ฒ์ฒ๋ผ, ์ด์ ๊ฐ์ด ์ปค์คํ ๊ฐ๋ฅํฉ๋๋ค.
import { styled } from '@mui/material/styles';
import CircularProgress, {
circularProgressClasses,
CircularProgressProps,
} from '@mui/material/CircularProgress';
import LinearProgress, { linearProgressClasses } from '@mui/material/LinearProgress';
const BorderLinearProgress = styled(LinearProgress)(({ theme }) => ({
height: 10,
borderRadius: 5,
[`&.${linearProgressClasses.colorPrimary}`]: {
backgroundColor: theme.palette.grey[theme.palette.mode === 'light' ? 200 : 800],
},
[`& .${linearProgressClasses.bar}`]: {
borderRadius: 5,
backgroundColor: theme.palette.mode === 'light' ? '#1a90ff' : '#308fe8',
},
}));
์ด ์ฝ๋๋ dark, light ๋ชจ๋๋ฅผ ์ง์ํ๋๋ผ theme.palette.mode === 'light' ๋ฅผ ์์ฑํ ๊ฒ์ผ๋ก...
์ด๊ฒ๋! ์ข์ง๋ง,, ์ ๋ ๊ฒ์ ํจ๊ณผ๊ฐ ๋๋! ๋ฐ๋ฐ๊ณผ ์ฌํ๋ณด๋จ ์ข ๋ ์บ๋ฆญํฐ์ค๋ฌ์ด ๋ ๋ฒจ๋ฐ๊ฐ ์ข๊ธฐ ๋๋ฌธ์
์ฝ๋๋ฅผ ์์ ํด๋ณด๊ฒ ์ต๋๋ค!
02. Level Bar
/** Level Progress Bar */
const BorderLinearProgress = styled(LinearProgress)(({ theme }) => ({
height: "2.4rem",
borderRadius: "100rem",
[`&.${linearProgressClasses.colorPrimary}`]: {
backgroundColor: theme.palette.grey[300],
boxShadow: "0 1px 2px #999 inset, 0 1px #ffffff",
},
[`& .${linearProgressClasses.bar}`]: {
borderRadius: "100rem",
backgroundColor: "#C8F2A7",
boxShadow: "0px -3px 0px 9px #76D22D inset",
width: "50%", // xp ๊ฐ์ ๋ฐ๋ผ ์๋ฅผ ์กฐ์ ํ๊ธฐ
},
}));
const levelProgressBar = (
<Box>
<BorderLinearProgress variant="determinate" value={100} />
</Box>
);
์ฃผ์ ํ์ค ์ ์ <BorderLinearProgress variant="determinate" value={100} />์์ 100์ผ๋ก ํด๋๋ ์ด์ ๊ฐ
์๋์ ๊ฐ์ด, ์ ํํ ๋ถ๋ถ์ ์ผ๋งํผ ์จ๊ธฐ์ง ์๊ณ ๋ณด์ฌ์ค ๊ฒ์ธ๊ฐ์ด๊ธฐ ๋๋ฌธ์ 100์ผ๋ก ํ ๊ฒ๋๋ค!
์ฝ๋ ์ง์ ์์ ํ์๋ฉด์ ์์ค ์ ์์ ๊ฑฐ์์! ๐๐
๊ทธ๋ฆฌ๊ณ XP ๊ฐ์ ๋ฐ๋ผ ๋ฐ๋ ๋ฐ์ ๊ธธ์ด๋ linearProgressClasses.bar์ width๋ฅผ ํตํด ๋ฐ๊ฟ ์ ์์ฃ โจโจ
์ ์ฝ๋๋, ์ ๊ฐ ์ง์ ํ๋ํ๋ ํด๋ณด๋ฉด์ ๊ตฌํํ ๊ฑฐ๋ผ์ ๋ณธ์ธ์ ์ปดํฌ๋ํธ์ ๋ง๊ฒ ์ฐธ๊ณ ํ์ ์ ์ฌ์ฉํ์๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค~!
์์ ๋ ์จ๊ฐ ๋๋ฌด ์ข์์ ์ข์๐๐๐