Skip to content

Commit 538faf0

Browse files
committed
ADD :: 404페이지
1 parent 72b420e commit 538faf0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/404.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { useNavigate } from "react-router-dom";
2+
import Button from "./components/button";
3+
import styled from "styled-components";
4+
5+
export const NotFound = () => {
6+
const router = useNavigate();
7+
return (
8+
<Container>
9+
<h1>404 Not Found</h1>
10+
<Button width="100" onClick={() => router('/main')}>메인으로 가기</Button>
11+
</Container>
12+
);
13+
}
14+
15+
const Container = styled.div`
16+
display: flex;
17+
flex-direction: column;
18+
align-items: center;
19+
justify-content: center;
20+
height: 100vh;
21+
gap: 16px;
22+
`

src/router/router.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { NotFound } from "@/404";
12
import Attendance from "@/pages/attendance";
23
import Bug from "@/pages/bug";
34
import Login from "@/pages/login";
@@ -21,6 +22,10 @@ export const Router = createBrowserRouter([
2122
path: "",
2223
element: <Login />,
2324
},
25+
{
26+
path: '*',
27+
element: <NotFound />
28+
},
2429
{
2530
path: "main",
2631
element: <Main />,

0 commit comments

Comments
 (0)