Skip to content

Commit

Permalink
Merge pull request #411 from ttaerrim/410-404
Browse files Browse the repository at this point in the history
[Feat] 404 페이지 추가
  • Loading branch information
ttaerrim authored Dec 10, 2023
2 parents cb3ed21 + eb62db3 commit 71ae755
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/frontend/src/hooks/useRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import {
MapLayout,
Groups,
ProfilePage,
NotFound,
} from '@/pages';

export const useRouter = () =>
createBrowserRouter([
{
path: '/',
element: <Layout />,
errorElement: <NotFound />,
children: [{ index: true, element: <MainPage /> }],
},
{
Expand Down
31 changes: 31 additions & 0 deletions app/frontend/src/pages/NotFound/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { style } from '@vanilla-extract/css';

import { vars } from '@/styles';
import { sansBold16, sansRegular16 } from '@/styles/font.css';

const { morakGreen } = vars.color;

export const button = style([
sansBold16,
{
textDecorationLine: 'underline',
color: morakGreen,
cursor: 'pointer',
},
]);

export const container = style({
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '100vh',
});

export const text = style([
sansRegular16,
{
textAlign: 'center',
whiteSpace: 'break-spaces',
lineHeight: '2rem',
},
]);
25 changes: 25 additions & 0 deletions app/frontend/src/pages/NotFound/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useNavigate } from 'react-router-dom';

import { MessageWrapper } from '@/components';

import * as styles from './index.css';

export function NotFound() {
const navigate = useNavigate();

const onClickMain = () => {
navigate('/');
};
return (
<div className={styles.container}>
<MessageWrapper>
<p className={styles.text}>
{`페이지를 찾을 수 없습니다.\n`}
<button type="button" onClick={onClickMain} className={styles.button}>
메인 페이지로 이동하기
</button>
</p>
</MessageWrapper>
</div>
);
}
1 change: 1 addition & 0 deletions app/frontend/src/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export * from './Map';
export * from './Mogaco';
export * from './MogacoDetail';
export * from './MogacoPost';
export * from './NotFound';
export * from './Profile';

0 comments on commit 71ae755

Please sign in to comment.