Skip to content

Commit c4e7329

Browse files
authored
Merge pull request #144 from prgrms-web-devcourse-final-project/102-design/404
[Feature] #102 404 페이지
2 parents 8db29cb + efc4b4c commit c4e7329

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

src/components/LazyComponents.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ export const RegisterDogPage = lazy(() => import('~pages/RegisterPage/Dog'))
1111
export const WalkCompletePage = lazy(() => import('~pages/WalkCompletePage'))
1212
export const ProfilePage = lazy(() => import('~pages/ProfilePage'))
1313
export const FamilyDDangPage = lazy(() => import('~pages/FamilyDDangPage'))
14+
export const NotFoundPage = lazy(() => import('~pages/NotFoundPage'))

src/pages/NotFoundPage/index.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import DogFood from '~assets/dog_food.svg?react'
2+
import { ActionButton } from '~components/Button/ActionButton'
3+
import { Typo24 } from '~components/Typo'
4+
import * as S from './styles'
5+
import { useNavigate } from 'react-router-dom'
6+
7+
export default function NotFoundPage() {
8+
const navigate = useNavigate()
9+
return (
10+
<S.NotFoundPage>
11+
<S.ErrorMessage>404!</S.ErrorMessage>
12+
<Typo24 $textAlign='center' $weight='800' style={{ marginBottom: 24 }}>
13+
요청하신 페이지를 찾을 수 없어요
14+
</Typo24>
15+
<ActionButton $type='roundedRect' onClick={() => navigate(-1)}>
16+
되돌아가기
17+
</ActionButton>
18+
<S.Wrapper>
19+
<DogFood />
20+
</S.Wrapper>
21+
</S.NotFoundPage>
22+
)
23+
}

src/pages/NotFoundPage/styles.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { styled } from 'styled-components'
2+
3+
export const NotFoundPage = styled.div`
4+
height: 100%;
5+
display: flex;
6+
align-items: center;
7+
justify-content: center;
8+
flex-direction: column;
9+
padding: 0 20px 30%;
10+
`
11+
12+
export const ErrorMessage = styled.p`
13+
font-size: 64px;
14+
text-align: center;
15+
font-weight: 800;
16+
color: ${({ theme }) => theme.colors.brand.default};
17+
`
18+
export const Wrapper = styled.div`
19+
position: absolute;
20+
bottom: 12%;
21+
`

src/router.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import Footer from '~components/Footer'
21
import { createBrowserRouter, Outlet } from 'react-router-dom'
3-
import * as Pages from './components/LazyComponents'
4-
import ModalContainer from '~modals/ModalContainer'
52
import { WebSocketProvider } from '~/WebSocketContext'
3+
import Footer from '~components/Footer'
4+
import ModalContainer from '~modals/ModalContainer'
5+
import * as Pages from './components/LazyComponents'
66

77
export const router = createBrowserRouter([
88
{
@@ -47,6 +47,10 @@ export const router = createBrowserRouter([
4747
path: '/profile/:id',
4848
element: <Pages.ProfilePage />,
4949
},
50+
{
51+
path: '*',
52+
element: <Pages.NotFoundPage />,
53+
},
5054
],
5155
},
5256
{

0 commit comments

Comments
 (0)