Skip to content

Commit 3ae4f68

Browse files
Merge pull request #207 from SOPT-36-NINEDOT/feat/#206/404
[Feat]: 404 페이지 구현
2 parents e307c4c + 339992e commit 3ae4f68

File tree

5 files changed

+76
-1
lines changed

5 files changed

+76
-1
lines changed

src/page/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ export { default as History } from './history/History';
55
export { default as SignUp } from './signup/SignUp';
66
export { default as Edit } from './edit/Edit';
77
export { default as GoogleCallback } from './callback/GoogleCallback';
8+
export { default as NotFound } from './notFound/NotFound';

src/page/notFound/NotFound.css.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { style } from '@vanilla-extract/css';
2+
3+
import { colors, fonts, layout } from '@/style/token';
4+
5+
export const container = style([
6+
layout.columnCenter,
7+
{
8+
gap: '4rem',
9+
height: 'calc(100vh - 15rem - 8rem)',
10+
backgroundColor: colors.grey1,
11+
textAlign: 'center',
12+
},
13+
]);
14+
15+
export const title = style([
16+
fonts.display03,
17+
{
18+
color: colors.grey11,
19+
},
20+
]);
21+
22+
export const button = style([
23+
fonts.subtitle05,
24+
{
25+
width: '19.6rem',
26+
height: '5.4rem',
27+
padding: '1.4rem 2rem',
28+
backgroundColor: colors.blue06,
29+
borderRadius: '8px',
30+
color: colors.grey11,
31+
textAlign: 'center',
32+
},
33+
]);

src/page/notFound/NotFound.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { useNavigate } from 'react-router-dom';
2+
3+
import * as styles from './NotFound.css';
4+
5+
import { PATH } from '@/route';
6+
7+
const TEXT = {
8+
title: ['찾으시는 페이지가 없어요', '홈으로 돌아가 볼까요?'],
9+
button: '홈으로 가기',
10+
} as const;
11+
12+
const NotFound = () => {
13+
const navigate = useNavigate();
14+
15+
const handleGoHome = () => {
16+
navigate(PATH.ROOT);
17+
};
18+
19+
return (
20+
<main className={styles.container}>
21+
<h1 className={styles.title}>
22+
{TEXT.title.map((line, index) => (
23+
<span key={`${line}-${index}`}>
24+
{line}
25+
{index !== TEXT.title.length - 1 && <br />}
26+
</span>
27+
))}
28+
</h1>
29+
<button type="button" className={styles.button} onClick={handleGoHome}>
30+
{TEXT.button}
31+
</button>
32+
</main>
33+
);
34+
};
35+
36+
export default NotFound;

src/route/MainRoutes.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { RouteObject } from 'react-router-dom';
22

33
import { PATH } from './path';
44

5+
import { Home, NotFound } from '@/page';
56
import { Layout } from '@/shared/component/Layout';
6-
import Home from '@/page/home/Home';
77
import Intro from '@/page/intro/Intro';
88

99
export const mainRoutes: RouteObject[] = [
@@ -81,6 +81,10 @@ export const mainRoutes: RouteObject[] = [
8181
return { Component: SignUp };
8282
},
8383
},
84+
{
85+
path: PATH.NOT_FOUND,
86+
element: <NotFound />,
87+
},
8488
],
8589
},
8690
];

src/route/path.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const PATH = {
1212
PRIVACY: '/privacy',
1313
SIGNUP: '/signup',
1414
REDIRECT: '/auth/google/callback',
15+
NOT_FOUND: '*',
1516
} as const;
1617

1718
export type PathType = (typeof PATH)[keyof typeof PATH];

0 commit comments

Comments
 (0)