forked from codesquad-members-2023/kiosk-max
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [#68] chore: msw핸들러 추가 * [#68] chore: 로고 파일 추가 * [#68] design: 로딩인디케이터, 결제 실패사유 ui * [#68] feat: 카드 결제 진행시 번호 입력할 인풋 렌더링 * [#68] feat: 카드 결제 진행 - 결제 실패 상황 구현 * [#44] fix: 모달창을 닫으면 시간이 멈추던 장바구니 타이머 버그 수정 - 모달창을 닫으면 시간이 초기화된 후 다시 타이머가 흐른다 * [#68] feat: timer컴포넌트 분리 * [#68] comment: 주석추가
- Loading branch information
Showing
17 changed files
with
335 additions
and
171 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.seconds { | ||
font: var(--font-body-large); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { OrderData } from '../../utils/types'; | ||
import { useEffect, useState } from 'react'; | ||
import classes from './Timer.module.css'; | ||
|
||
export function Timer({ | ||
orderList, | ||
setOrderList, | ||
isPayProcessing, | ||
}: { | ||
orderList: OrderData[]; | ||
setOrderList: React.Dispatch<React.SetStateAction<OrderData[]>>; | ||
isPayProcessing: boolean; | ||
}) { | ||
const [seconds, setSeconds] = useState(500); | ||
|
||
useEffect(() => { | ||
if (orderList.length === 0 || isPayProcessing) { | ||
setSeconds(500); | ||
} else { | ||
const timer = setTimeout(() => { | ||
setSeconds((prevSeconds) => prevSeconds - 1); | ||
}, 1000); | ||
|
||
if (isPayProcessing) { | ||
clearTimeout(timer); | ||
} | ||
|
||
if (seconds === 0) { | ||
clearTimeout(timer); | ||
setOrderList([]); | ||
} | ||
|
||
return () => { | ||
clearTimeout(timer); | ||
}; | ||
} | ||
}, [orderList, seconds, isPayProcessing]); | ||
// orderList의존성빼기 | ||
useEffect(() => { | ||
if (!isPayProcessing) { | ||
setSeconds(500); | ||
} | ||
}, [isPayProcessing]); | ||
|
||
return <span className={classes.seconds}>{seconds}</span>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.loading { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
border-radius: 5px; | ||
background-color: var(--color-white); | ||
z-index: 2; | ||
} | ||
|
||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 4.2rem; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.logo { | ||
animation: flip 2s ease-in-out infinite; | ||
} | ||
|
||
@keyframes flip { | ||
0% { | ||
transform: perspective(800px) rotateY(0deg); | ||
} | ||
50% { | ||
transform: perspective(800px) rotateY(180deg); | ||
} | ||
100% { | ||
transform: perspective(800px) rotateY(360deg); | ||
} | ||
} | ||
|
||
.text { | ||
font: var(--font-body-large); | ||
font-size: 2rem; | ||
color: var(--color-black); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import classes from './Loading.module.css'; | ||
|
||
export function Loading() { | ||
return ( | ||
<div className={classes.loading}> | ||
<div className={classes.wrapper}> | ||
<img className={classes.logo} src="/assets/logo.png" alt="logo" /> | ||
<p className={classes.text}>결제 진행중...</p> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.cause { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
border-radius: 5px; | ||
background-color: var(--color-white); | ||
z-index: 2; | ||
padding: 0 70px; | ||
} | ||
|
||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 5rem; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.causeTitle { | ||
font: var(--font-body-large); | ||
font-size: 3.7rem; | ||
color: var(--color-black); | ||
} | ||
|
||
.causeText { | ||
font: var(--font-body-large); | ||
font-size: 2rem; | ||
color: var(--color-black); | ||
} | ||
|
||
.btn { | ||
width: 100%; | ||
padding: 2rem; | ||
border-radius: 5px; | ||
font: var(--font-body-large); | ||
color: var(--color-white); | ||
background: var(--color-red); | ||
} |
Oops, something went wrong.