Skip to content

Commit

Permalink
feat: add deco toast msg
Browse files Browse the repository at this point in the history
  • Loading branch information
kcwww committed Dec 12, 2023
1 parent e3d2e37 commit 4704bb5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions front/src/pages/Make/Snowball/MainDeco/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ const ButtonBox = styled.div`
justify-content: center;
`;

const ToastMsg = styled.div`
position: fixed;
top: 70%;
left: 50%;
transform: translate(-50%, -50%);
font: ${props => props.theme.font['--normal-button-font']};
background-color: ${props => props.theme.colors['--sub-text']};
border-radius: 1rem;
text-align: center;
padding: 1rem;
`;

const Steps = () => {
const [step, setStep] = useState<number>(0);
const [lastBox, setLastBox] = useState(false);
Expand Down Expand Up @@ -171,6 +184,17 @@ const Steps = () => {
};
}, [isDecoBoxClicked]);

const [toast, setToast] = useState(false);

useEffect(() => {
if (step === selectDeco) {
setToast(true);
setTimeout(() => {
setToast(false);
}, 1500);
}
}, [step]);

useEffect(() => {
if (alert === good) setStep(step + 1);
else if (alert === returnPrev) setStep(step - 1);
Expand All @@ -191,6 +215,7 @@ const Steps = () => {

return (
<>
{toast ? <ToastMsg>๋“œ๋ž˜๊ทธ๋ฅผ ํ•˜์—ฌ ์—ฌ๋Ÿฌ ์žฅ์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š” !</ToastMsg> : null }
<Container>
<HeaderText Ref={null} userName={userData.nickname} />

Expand Down
25 changes: 25 additions & 0 deletions front/src/pages/Visit/Deco/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ const ButtonBox = styled.div`
justify-content: center;
`;

const ToastMsg = styled.div`
position: fixed;
top: 70%;
left: 50%;
transform: translate(-50%, -50%);
font: ${props => props.theme.font['--normal-button-font']};
background-color: ${props => props.theme.colors['--sub-text']};
border-radius: 1rem;
text-align: center;
padding: 1rem;
`;

const Steps = () => {
const [step, setStep] = useState(0);
const [lastBox, setLastBox] = useState(false);
Expand Down Expand Up @@ -161,6 +174,17 @@ const Steps = () => {
};
}, [isDecoBoxClicked]);

const [toast, setToast] = useState(false);

useEffect(() => {
if (step === selectDeco || step === selectMsgColor) {
setToast(true);
setTimeout(() => {
setToast(false);
}, 1500);
}
}, [step]);

const renderStateBoxes = () => {
const boxes = [];
for (let i = 0; i <= step; i++) {
Expand All @@ -176,6 +200,7 @@ const Steps = () => {

return (
<>
{toast ? <ToastMsg>{step === selectDeco ? '๋“œ๋ž˜๊ทธ๋ฅผ ํ•˜์—ฌ ์—ฌ๋Ÿฌ ์žฅ์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š” !' : '๋“œ๋ž˜๊ทธ๋ฅผ ํ•˜์—ฌ ์—ฌ๋Ÿฌ ์ƒ‰๊น”์„ ํ™•์ธํ•ด๋ณด์„ธ์š” !'}</ToastMsg> : null }
<Container>
<HeaderText Ref={null} userName={userData.nickname} />

Expand Down

0 comments on commit 4704bb5

Please sign in to comment.