-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 마이페이지 이동 시 리뷰 응답, 생성 시 모달 처리 * feat: 리뷰 마감 전송시 모달 띄우기 처리 * refactor: useEffect의존성 제거 * refactor: 모달 문구 수정 * refactor: 모달 라벨 문구 수정
- Loading branch information
Showing
4 changed files
with
110 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState, useEffect } from 'react' | ||
import { useLocation } from 'react-router-dom' | ||
|
||
const useCheckHeaderRoute = () => { | ||
const location = useLocation() | ||
const [logoButtonClicked, setLogoButtonClicked] = useState<boolean>(false) | ||
const [prevButtonClicked, setPrevButtonClicked] = useState<boolean>(false) | ||
const [myPageButtonClicked, setMyPageButtonClicked] = useState<boolean>(false) | ||
|
||
useEffect(() => { | ||
if ( | ||
location.pathname === '/review-creation' || | ||
location.pathname.includes('/review-response') | ||
) { | ||
setLogoButtonClicked(true) | ||
setPrevButtonClicked(true) | ||
setMyPageButtonClicked(true) | ||
} else { | ||
setLogoButtonClicked(false) | ||
setPrevButtonClicked(false) | ||
setMyPageButtonClicked(false) | ||
} | ||
|
||
return () => { | ||
setLogoButtonClicked(false) | ||
setMyPageButtonClicked(false) | ||
setPrevButtonClicked(false) | ||
} | ||
}, []) | ||
|
||
return { logoButtonClicked, prevButtonClicked, myPageButtonClicked } | ||
} | ||
|
||
export default useCheckHeaderRoute |
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