Skip to content

Commit a5fe005

Browse files
committed
not found page デザイン
1 parent 8dafc27 commit a5fe005

File tree

2 files changed

+42
-5
lines changed

2 files changed

+42
-5
lines changed

sample/src/pages/404.stories.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import NotFoundPage from '@/pages/404'
2+
import type { Meta, StoryObj } from '@storybook/react'
3+
import { MemoryRouter, Route, Routes } from 'react-router-dom'
4+
5+
const meta: Meta<typeof NotFoundPage> = {
6+
title: 'pages/404',
7+
component: NotFoundPage,
8+
parameters: {
9+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
10+
layout: 'fullscreen',
11+
},
12+
tags: ['autodocs'],
13+
}
14+
15+
export default meta
16+
17+
type Story = StoryObj<typeof NotFoundPage>
18+
19+
/**
20+
* 標準フッター
21+
*/
22+
export const Default: Story = {
23+
render: () => (
24+
<MemoryRouter initialEntries={['/']}>
25+
<Routes>
26+
<Route path="/" element={<NotFoundPage />} />
27+
</Routes>
28+
</MemoryRouter>
29+
),
30+
}

sample/src/pages/404.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import { Link } from 'react-router-dom'
22

33
const NotFoundPage = () => (
4-
<>
5-
<h1>404 NOT FOUND</h1>
6-
<p>お探しのページは見つかりませんでした。</p>
7-
<Link to="/">戻る</Link>
8-
</>
4+
<div className="container flex flex-col">
5+
<h1 className="text-3xl m-auto mt-5">404 NOT FOUND</h1>
6+
<p className="text-base text-red-600 mx-auto mt-5">
7+
お探しのページは見つかりませんでした。
8+
</p>
9+
<Link
10+
to="/"
11+
className="border-2 w-28 h-9 text-center rounded-md bg-blue-400 text-white mx-auto my-5 p-1"
12+
>
13+
戻る
14+
</Link>
15+
</div>
916
)
1017

1118
export default NotFoundPage

0 commit comments

Comments
 (0)