forked from SWYP-team-2th/client
-
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.
* 404 페이지를 제작한다. * title 변경 * 404 navigate 로직 작성 * 리다이렉트 로직 수정
- Loading branch information
Showing
4 changed files
with
69 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
import useGetMyInfo from '@/api/useGetMyInfo'; | ||
import Logo from '@/assets/icons/logo.svg?react'; | ||
import NotFoundImage from '@/assets/images/not-found.png'; | ||
import { Button } from '@/components/common/Button/Button'; | ||
import { Header } from '@/components/common/Header/Header'; | ||
import Icon from '@/components/common/Icon'; | ||
import { getAccessToken } from '@/components/login/Auth/token'; | ||
|
||
export default function NotFoundPage() { | ||
const navigate = useNavigate(); | ||
const accessToken = getAccessToken(); | ||
|
||
const { data: myInfo } = useGetMyInfo({ | ||
enabled: !!accessToken, | ||
}); | ||
|
||
const handleClickBackButton = () => { | ||
navigate(-1); | ||
}; | ||
|
||
const handleClickGoToHomeButton = () => { | ||
if (myInfo?.id) { | ||
navigate(`/user/${myInfo.id}`); | ||
} else { | ||
navigate('/onboarding'); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="relative w-full h-[100dvh]"> | ||
<Header | ||
leftNode={ | ||
<Icon | ||
name="ArrowLeft" | ||
size="medium" | ||
onClick={handleClickBackButton} | ||
/> | ||
} | ||
centerNode={<Logo style={{ width: 70 }} />} | ||
rightNode={<Icon name="UserOutline" size="medium" />} | ||
/> | ||
<div className="flex gap-[55px] w-full flex-col items-center justify-center absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"> | ||
<img src={NotFoundImage} alt="not-found" width={200} height={200} /> | ||
<div className="flex flex-col gap-2 justify-center items-center"> | ||
<p className="text-h3">앗! 잘못된 주소예요!🥲</p> | ||
<p className="text-title-x-small"> | ||
선택한 페이지가 없거나 삭제되었어요. | ||
</p> | ||
</div> | ||
</div> | ||
<Button | ||
buttonType="primary" | ||
size="large" | ||
variant="solid" | ||
className="fixed bottom-16 left-1/2 -translate-x-1/2" | ||
onClick={handleClickGoToHomeButton} | ||
> | ||
홈으로 가기 | ||
</Button> | ||
</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