Skip to content

Commit 97474e3

Browse files
committed
feat: 404.tsx 개발
1 parent 2b59eb3 commit 97474e3

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

public/icon/error.svg

Lines changed: 4 additions & 0 deletions
Loading

src/App.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import MbtiTestQuestions from "@/pages/MbtiTestQuestions";
2020
import MbtiTestResult from "@/pages/MbtiTestResult";
2121
import CenteredLayout from "@/components/CenteredLayout";
2222
import { initGA, trackPageView } from "@/libs/analytics";
23+
import NotFound from "@/pages/NotFound";
2324

2425
const PageTracker = () => {
2526
const location = useLocation();
@@ -77,16 +78,23 @@ const App = () => {
7778
<Route path="/" element={<Home />} />
7879
<Route path="/select-info" element={<SelectInfo />} />
7980
<Route path="/chat" element={<Chat />} />
80-
<Route path="/chat-recommend" element={<ChatRecommend />} />
81-
<Route path="/chat-tips" element={<ChatTips />} />
82-
<Route path="/chat-temporature" element={<ChatTemporature />} />
81+
<Route
82+
path="/chat-recommend/:virtualFriendId"
83+
element={<ChatRecommend />}
84+
/>
85+
<Route path="/chat-tips/:virtualFriendId" element={<ChatTips />} />
86+
<Route
87+
path="/chat-temporature/:conversationId"
88+
element={<ChatTemporature />}
89+
/>
8390
<Route path="/contents/:id" element={<Content />} />
8491
<Route path="/login" element={<Login />} />
8592
<Route path="/my-info" element={<MyInfo />} />
8693
<Route path="/kakao-login" element={<KaKaoLogin />} />
87-
<Route path="/mbti-test" element={<MbtiTestIntro />} />
94+
<Route path="/mbti-test" element={<MbtiTestIntro />} />
8895
<Route path="/mbti-test-progress" element={<MbtiTestQuestions />} />
8996
<Route path="/mbti-test-result" element={<MbtiTestResult />} />
97+
<Route path="*" element={<NotFound />} />
9098
</Routes>
9199
</CenteredLayout>
92100
</Router>

src/pages/NotFound.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import PrimaryButton from "@/components/button/PrimaryButton";
2+
import { useNavigate } from "react-router-dom";
3+
4+
const NotFound = () => {
5+
const navigate = useNavigate();
6+
7+
const goHome = () => {
8+
navigate("/");
9+
};
10+
11+
return (
12+
<main className="relative flex flex-col items-center bg-white">
13+
<div className="absolute bottom-[372px] flex h-[196px] flex-col items-center justify-between">
14+
<img
15+
src="/icon/error.svg"
16+
alt="404 페이지 아이콘"
17+
width={63}
18+
height={63}
19+
/>
20+
<h1 className="text-2xl font-bold ">페이지를 찾을 수 없습니다.</h1>
21+
<p className=" text-center text-gray-600">
22+
입력하신 주소가 올바르지 않거나,
23+
<br />
24+
요청하신 페이지가 삭제되었을 수 있습니다.
25+
</p>
26+
</div>
27+
<div className="absolute bottom-[60px]">
28+
<PrimaryButton size="md" onClick={goHome}>
29+
홈으로 가기
30+
</PrimaryButton>
31+
</div>
32+
</main>
33+
);
34+
};
35+
36+
export default NotFound;

0 commit comments

Comments
 (0)