ํผ๊ทธ๋ง ์์์ ์ ๊ณต๋ฐ์ ๋ฆฌ์กํธ๋ก ๋ฒํผ UI ๋ฅผ ๊ตฌํํ๋ ์ค์ต์ ๋๋ค.
์์ฑ๋ ๋ชจ์ต์ ๋๋ค.
- ๋ฒํผ UI ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ์ฅํ ํด๋๋ฅผ ๋ง๋ค๊ณ , ํฐ๋ฏธ๋ ์ฐฝ์ ์ด์ด ๋ฐ์ ์ฃผ์๋ฅผ ๋ณต์ฌํ์ฌ git clone ํฉ๋๋ค.
https://github.com/CHAERYEON-LEE/icon-button-UI.git
- ๋ฒํผ์ ์คํ์ํค๊ธฐ ์ํด ํ์ํ ๋ชจ๋์ ์ค์นํ๋ ค๋ฉด ํด๋น ๋ช ๋ น์ด๋ฅผ ํฐ๋ฏธ๋์ ์ ๋ ฅํฉ๋๋ค.
npm i
- ๋ฒํผ์ local์์ ์คํ์ํค๋ ค๋ฉด ํด๋น ๋ช ๋ น์ด๋ฅผ ํฐ๋ฏธ๋์ ์ ๋ ฅํฉ๋๋ค.
npm run dev
๊ธฐ๋ณธ ์ ๊ณต๋๋ ๋ฒํผ์ ์ข ๋ฅ๋ 5๊ฐ์ง ์ ๋๋ค.
status | idle | pending | resolved | rejected | disabled |
---|---|---|---|---|---|
์ํ | ์ ๋ก๋ | ์ ๋ก๋ ์ค | ์๋ฃ | ์ ๋ก๋์คํจ | ์คํจ |
์ถ๋ ฅ |
<UploadButton status="idle"></UploadButton>
<UploadButton status="pending"></UploadButton>
<UploadButton status="resolved"></UploadButton>
<UploadButton status="rejected"></UploadButton>
<UploadButton status="disabled"></UploadButton>
status ๋ฅผ ์ ๋ ฅํด์ฃผ์ง ์์๋ ๋ฒํผ์ ๊ธฐ๋ณธ status ๋ idle(์ ๋ ฅ์ค)์ผ๋ก ๋์ด ์์ต๋๋ค.
<UploadButton></UploadButton>
์ถ๋ ฅ
src/components/UploadButton.js ํ์ผ์ uploadStatus ๊ฐ์ฒด์ ํ๋กํผํฐ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
src/components/UploadButton.js ํ์ผ์ uploadStatus ๊ฐ์ฒด์์
const uploadStatus = {
idle:{
text: "์
๋ก๋",
path: "../assets/icons/type=up-arrow.svg"
},
pending:{
text: "์
๋ก๋ ์ค",
path: "../assets/icons/type=spinner-animate.svg"
},
resolved:{
text: "์๋ฃ",
path: "../assets/icons/type=check-mark.svg"
},
rejected:{
text: "์คํจ",
path: "../assets/icons/type=cross.svg"
},
disabled:{
text: "์
๋ก๋",
path: "../assets/icons/type=not-allowed.svg",
style: {
filter:'invert(76%) sepia(8%) saturate(202%) hue-rotate(196deg) brightness(92%) contrast(89%)'
}
}
}
ํ๋กํผํฐ ์ถ๊ฐ
const uploadStatus = {
sayYeah:{
text: "์๋
",
path: "../assets/icons/type=up-arrow.svg"
}
}
์ฌ์ฉ ์์
<UploadButton status="sayYeah"></UploadButton>
์ถ๋ ฅ