forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat/#467] ✨ feat: 페이지 별로 브금 다르게 세팅, 브금 반복
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { usePathname } from 'next/navigation'; | ||
import useBgmStore from '../_store/useBgmStore'; | ||
|
||
const useBgm = () => { | ||
const { setBgm } = useBgmStore(); | ||
const url = usePathname(); | ||
const quizUrl = ['/quiz-room']; | ||
const mainBgm = '/bgm/main.mp3'; | ||
const quizBgm = '/bgm/quiz.mp3'; | ||
const checkUrlAndChangeBgm = () => { | ||
if (quizUrl.includes(url)) { | ||
setBgm(quizBgm); | ||
} else { | ||
setBgm(mainBgm); | ||
} | ||
}; | ||
return { checkUrlAndChangeBgm, url }; | ||
}; | ||
|
||
export default useBgm; |