
npm install garlic-toastGarlic-Toast๋ ๋ค๋ฅธ Toast ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ฅ์ ๋ค์ ํ๋ฐ ๋ชจ์, sh
npm
npm install garlic-toast
yarn
yarn add garlic-toast
pnpm
pnpm add garlic-toast
`
๐ช Basic Usage
`jsx
import { ToastContainer, toast } from 'garlic-toast';
import 'garlic-toast/style.css'; // CSS ์คํ์ผ ํ์ผfunction App() {
const alert = () => toast.alert('ํ ์คํธ ์ถ๋ ฅ!')
return (
);
}
`
๐ ToastContainer
> `tsx
>
> `
`sh
poistion="์์น" # ๊ธฐ๋ณธ ์ถ๋ ฅ์์น (ํ์)
time={ms} # ๊ธฐ๋ณธ ์ถ๋ ฅ ์ ์ง์๊ฐ (ํ์)
isFold # ํ ์คํธ ๊ฒน์ณ์ ์ถ๋ ฅ๋๋ ์คํ์ผ (์ ํ)
`
App.jsx or App.tsx ํ์ผ์ ์ถ๊ฐํ์๋๊ฑธ ๊ถ์ฅ๋๋ฆฝ๋๋ค.
๐ฅช Toast
> `jsx
> toast.ํ์
(๋ฉ์ธ์ง ๋ด์ฉ, {์ต์
})
> `
$3
#### Basic Type
`sh
1. alert # ๊ธฐ๋ณธ์ ์ธ ์๋ฟ ๋ฐฉ์์
๋๋ค.
2. success # event๊ฐ ์ฑ๊ณตํ์ ๊ฒฝ์ฐ ์ฌ์ฉ์ ๊ถ์ฅ๋๋ฆฝ๋๋ค.
3. error # event๊ฐ ์คํจํ์ ๊ฒฝ์ฐ ์ฌ์ฉ์ ๊ถ์ฅ๋๋ฆฝ๋๋ค.
4. warning # ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ์ ๋ฌ ํ ๊ฒฝ์ฐ ์ฌ์ฉ์ ๊ถ์ฅ๋๋ฆฝ๋๋ค.
5. info # ์ ๋ณด๋ฅผ ์ ๋ฌ ํ ๊ฒฝ์ฐ ์ฌ์ฉ์ ๊ถ์ฅ๋๋ฆฝ๋๋ค.
`#### Special Type -
confirm`tsx
toast.confirm(๋ฉ์ธ์ง ๋ด์ฉ).then(isConfirm => {
if (isConfirm) {
// ํ์ธ ํด๋ฆญ ์ ์คํ
} else {
// ์ทจ์ ํด๋ฆญ ์ ์คํ
}
})
`
$3
#### 1. position
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
position: "t-r"
})
`top, center, bottom๊ณผ left, center, right๋ฅผ ์กฐํฉํ์ฌ ํ ์คํธ์ ์์น๋ฅผ ์ค์ ํ ์ ์์ต๋๋ค.
| | | |
| :-: | :-: | :-: |
| t-l | t-c | t-r |
| c-l | c-c | c-r |
| b-l | b-c | b-r |---
#### 2. textColor
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
textColor: "#000000"
})
`๊ธ์์ ์์์ ์ค์ ํฉ๋๋ค.
---
#### 3. color
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
color: "#ffffff"
})
`
์๋ฆผ์ ๋ฐฐ๊ฒฝ์์ ์ค์ ํฉ๋๋ค.---
#### 4. closeOnClick
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
closeOnClick: true/false
})
`
์๋ฆผ์ ํด๋ฆญํ์ฌ ๋ซ์ ์ง ์ค์ ํฉ๋๋ค.---
#### 5. autoClose
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
autoClose: true/false
})
`
์๋ฆผ์ ์๋์ผ๋ก ๋ซํ๊ฒ ํ ์ง ์ค์ ํฉ๋๋ค.---
#### 6. autoCloseTime
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
autoCloseTime: 5000
})
`๋ช ms ํ ์๋ฆผ์ ๋ซ์ ์ง ์ค์ ํฉ๋๋ค.
---
#### 7. progressBar
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
progressBar: true/false
})
`progressBar๋ฅผ ๋ณด์ฌ์ค ์ง ์ค์ ํฉ๋๋ค.
---
#### 8. barColor
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
barColor: "#000000"
})
`progressBar์ ์์์ ์ค์ ํฉ๋๋ค.
---
#### 9. pauseOnHover
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
pauseOnHover: true/false
})
`
์๋ฆผ์ ๋ง์ฐ์ค๋ฅผ ์ฌ๋ ธ์ ๋ ์๋ฆผ์ ์๊ฐ์ ์ผ์์ ์ง ํ ์ง ์ค์ ํฉ๋๋ค.---
#### 10. customImage
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
customImage: "img/url"
})
`์๋ฆผ์ ์ฌ์ฉํ ์ด๋ฏธ์ง๋ฅผ ์ค์ ํฉ๋๋ค.
---
#### 11. confirmBtn
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
confirmBtn: "ํ์ธ"
})
`
ํ์ธ ๋ฒํผ์ ๋ฌธ๊ตฌ๋ฅผ ์ค์ ํฉ๋๋ค.---
#### 12. cancleBtn
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
cancleBtn: "์ทจ์"
})
`
์ทจ์ ๋ฒํผ์ ๋ฌธ๊ตฌ๋ฅผ ์ค์ ํฉ๋๋ค.---
#### 13. confirmBtnColor
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
confirmBtnColor: "#0000ff"
})
`ํ์ธ ๋ฒํผ์ ์์์ ์ค์ ํฉ๋๋ค.
---
#### 14. cancleBtnColor
`tsx
toast.alert('ํ ์คํธ ๋ฉ์์ง', {
confirmBtnColor: "#ff0000"
})
`
์ทจ์ ๋ฒํผ์ ์์์ ์ค์ ํฉ๋๋ค.---
๐ณ CONTRIBUTING
Garlic-Toast` ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ธฐ์ฌํ๊ณ ์ถ๋ค๊ณ ์๊ฐํ์
จ๋ค๋ฉด ์๋ ๋ฌธ์๋ฅผ ์ฐธ๊ณ ํด์ฃผ์ธ์.