-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: tooltip에 arrow icon 추가 * fix: 슬로프 명을 고급에서 상급으로 변경 * feat: 웹캠 로딩 추가 * feat: 웹캠 화면을 30초 후 닫도록 수정 * fix: svg console.log에러 해결 * fix: high1 스키장 웹캠 링크 재설정 * fix: 리뷰 대응
- Loading branch information
1 parent
6397e42
commit f7d4a52
Showing
9 changed files
with
225 additions
and
63 deletions.
There are no files selected for viewing
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,56 @@ | ||
import { useState, useEffect, useCallback } from 'react'; | ||
|
||
interface UseTimerReturn { | ||
timeLeft: number; | ||
isRunning: boolean; | ||
startTimer: (newTime?: number) => void; | ||
pauseTimer: () => void; | ||
resetTimer: (newTime?: number) => void; | ||
} | ||
|
||
const useTimer = (initialTime: number, onComplete?: () => void): UseTimerReturn => { | ||
const [timeLeft, setTimeLeft] = useState(initialTime); | ||
const [isRunning, setIsRunning] = useState(false); | ||
|
||
useEffect(() => { | ||
let intervalId: NodeJS.Timeout; | ||
|
||
if (isRunning && timeLeft > 0) { | ||
intervalId = setInterval(() => { | ||
setTimeLeft((prevTime) => prevTime - 1); | ||
}, 1000); | ||
} else if (timeLeft === 0) { | ||
setIsRunning(false); | ||
if (onComplete) { | ||
onComplete(); | ||
} | ||
} | ||
|
||
return () => { | ||
if (intervalId) { | ||
clearInterval(intervalId); | ||
} | ||
}; | ||
}, [isRunning, timeLeft, onComplete]); | ||
|
||
const startTimer = (newTime?: number) => { | ||
if (newTime !== undefined) { | ||
setTimeLeft(newTime); | ||
} | ||
setIsRunning(true); | ||
}; | ||
|
||
const pauseTimer = useCallback(() => setIsRunning(false), []); | ||
|
||
const resetTimer = useCallback( | ||
(newTime?: number) => { | ||
setIsRunning(false); | ||
setTimeLeft(newTime !== undefined ? newTime : initialTime); | ||
}, | ||
[initialTime] | ||
); | ||
|
||
return { timeLeft, isRunning, startTimer, pauseTimer, resetTimer }; | ||
}; | ||
|
||
export default useTimer; |
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,17 @@ | ||
import React from 'react'; | ||
|
||
const ArrowRightIcon = () => { | ||
return ( | ||
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M6.5 4.5L10.5 8.5L6.5 12.5" | ||
stroke="white" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default ArrowRightIcon; |
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,15 @@ | ||
import React from 'react'; | ||
import { cn } from '../lib'; | ||
|
||
interface LoadingProps { | ||
className?: string; | ||
} | ||
const Loading = ({ className }: LoadingProps) => { | ||
return ( | ||
<div | ||
className={cn('absolute h-4 w-4 animate-mulShdSpin rounded-full bg-black', className)} | ||
></div> | ||
); | ||
}; | ||
|
||
export default Loading; |
Oops, something went wrong.