Skip to content

Commit 8f8d683

Browse files
authored
Merge pull request #89 from Nexters/feat/#74
[Feat/#74] 커스텀 404, 500페이지 추가
2 parents ed76c63 + 5b62cc6 commit 8f8d683

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

src/app/error.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"use client";
2+
import InternalServerErrorImage from "@/shared/assets/images/500.png";
3+
import Button from "@/shared/components/Button";
4+
import Image from "next/image";
5+
import { useRouter } from "next/navigation";
6+
import { css } from "styled-components";
7+
8+
export default function Error() {
9+
const router = useRouter();
10+
11+
return (
12+
<div
13+
css={css`
14+
display: flex;
15+
flex-direction: column;
16+
margin-top: 150px;
17+
18+
width: 100%;
19+
max-width: 600px;
20+
margin-inline: auto;
21+
`}
22+
>
23+
<Image
24+
src={InternalServerErrorImage}
25+
alt=""
26+
style={{ width: "100%", height: "100%" }}
27+
css={css`
28+
aspect-ratio: 376 / 328;
29+
`}
30+
/>
31+
<Button
32+
color="grey70"
33+
css={css`
34+
width: 107px;
35+
margin-inline: auto;
36+
margin-top: 12px;
37+
`}
38+
onClick={() => router.push("/")}
39+
>
40+
돌아가기
41+
</Button>
42+
</div>
43+
);
44+
}

src/app/not-found.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"use client";
2+
3+
import NotFoundImage from "@/shared/assets/images/404.png";
4+
import Button from "@/shared/components/Button";
5+
import Image from "next/image";
6+
import { useRouter } from "next/navigation";
7+
import { css } from "styled-components";
8+
export default function NotFound() {
9+
const router = useRouter();
10+
11+
return (
12+
<div
13+
css={css`
14+
display: flex;
15+
flex-direction: column;
16+
margin-top: 150px;
17+
18+
width: 100%;
19+
max-width: 600px;
20+
margin-inline: auto;
21+
`}
22+
>
23+
<Image
24+
src={NotFoundImage}
25+
alt=""
26+
style={{ width: "100%", height: "100%" }}
27+
css={css`
28+
aspect-ratio: 376 / 328;
29+
`}
30+
/>
31+
<Button
32+
color="grey70"
33+
css={css`
34+
width: 107px;
35+
margin-inline: auto;
36+
margin-top: 12px;
37+
`}
38+
onClick={() => router.push("/")}
39+
>
40+
돌아가기
41+
</Button>
42+
</div>
43+
);
44+
}

src/shared/assets/images/404.png

98.9 KB
Loading

src/shared/assets/images/500.png

110 KB
Loading

0 commit comments

Comments
 (0)