Skip to content

Commit f9904fa

Browse files
authored
Merge pull request #82 from part3-4team-Taskify/feature/NotFound
[Feat] 404: 시간 경과 시 홈페이지 이동 기능, 홈페이지 이동하기 버튼 추가
2 parents bfa2328 + 91a8e98 commit f9904fa

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/pages/404.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1+
import { useEffect } from "react";
2+
import { useRouter } from "next/router";
3+
14
export default function Custom404() {
5+
const router = useRouter();
6+
7+
const goToMain = () => {
8+
router.push("/");
9+
};
10+
11+
useEffect(() => {
12+
const timer = setTimeout(() => {
13+
router.push("/");
14+
}, 5000);
15+
16+
return () => clearTimeout(timer);
17+
}, [router]);
18+
219
return (
3-
<div className="flex flex-col items-center justify-center h-screen text-center">
4-
<h1 className="text-4xl font-bold text-[var(--primary)]">
5-
404 Not Found
6-
</h1>
7-
<p className="mt-2 text-lg text-black3">페이지를 찾을 수 없습니다.</p>
20+
<div className="flex flex-col items-center justify-center text-center h-screen bg-[var(--color-gray5)] gap-2">
21+
<h1 className="font-24b text-[var(--primary)]">404 Not Found</h1>
22+
<p className="font-16r text-black3">페이지를 찾을 수 없습니다.</p>
23+
<p className="font-16r text-black3">5초 후 홈페이지로 이동합니다.</p>
24+
<button
25+
onClick={goToMain}
26+
className="w-[200px] h-[50px] bg-[var(--primary)] font-16m text-white rounded-lg cursor-pointer"
27+
>
28+
홈페이지 이동하기
29+
</button>
830
</div>
931
);
1032
}

0 commit comments

Comments
 (0)