Skip to content

Commit 0104a83

Browse files
authored
update:404ページのレイアウト (#37)
* update:404ページのレイアウト * style:lint
1 parent 3e402bd commit 0104a83

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

Diff for: app/pages/ErrorBoundaryPage/ErrorPageBase/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ interface Props {
66

77
export default function ErrorPageBase({ title, message, children }: Props) {
88
return (
9-
<div data-scrollable="false">
10-
<h1>{title}</h1>
9+
<div className="flex h-full flex-col items-center justify-center" data-scrollable="false">
10+
<h1 className="text-5xl font-bold">{title}</h1>
1111
<p>{message}</p>
1212
{children}
1313
</div>

Diff for: app/pages/ErrorBoundaryPage/index.tsx

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from '@/components/ui/button';
12
import { isRouteErrorResponse, Link } from '@remix-run/react';
23
import ErrorPageBase from './ErrorPageBase';
34

@@ -11,33 +12,43 @@ export default function ErrorBoundaryPage({ error, notFoundItem }: Props) {
1112
if (error.status === 404) {
1213
return (
1314
<ErrorPageBase message={`${notFoundItem}が見つかりませんでした.`} title="404 Not Found">
14-
<Link to="/">ホームへ</Link>
15+
<Button asChild className="mt-5">
16+
<Link to="/">ホームへ</Link>
17+
</Button>
1518
</ErrorPageBase>
1619
);
1720
} else if (error.status === 401) {
1821
return (
1922
<ErrorPageBase message="認証に失敗しました." title="401 Unauthorized">
20-
<Link to="/login">ログイン</Link>
23+
<Button asChild className="mt-5">
24+
<Link to="/login">ログイン</Link>
25+
</Button>
2126
</ErrorPageBase>
2227
);
2328
} else if (error.status === 500) {
2429
return (
2530
<ErrorPageBase message="サーバーでエラーが発生しました.しばらくしてから再度お試しください" title="500 Internal Server Error">
26-
<Link to="/">ホームへ</Link>
31+
<Button asChild className="mt-5">
32+
<Link to="/">ホームへ</Link>
33+
</Button>
2734
</ErrorPageBase>
2835
);
2936
} else {
3037
return (
3138
<ErrorPageBase message="エラーが発生しました." title={`${error.status} ${error.statusText}`}>
32-
<Link to="/">ホームへ</Link>
39+
<Button asChild className="mt-5">
40+
<Link to="/">ホームへ</Link>
41+
</Button>
3342
</ErrorPageBase>
3443
);
3544
}
3645
} else if (error instanceof Error) {
3746
return (
3847
<div>
3948
<ErrorPageBase message="エラーが発生しました." title="システムエラー">
40-
<Link to="/">ホームへ</Link>
49+
<Button asChild className="mt-5">
50+
<Link to="/">ホームへ</Link>
51+
</Button>
4152
<pre>{error.stack}</pre>
4253
</ErrorPageBase>
4354
</div>
@@ -46,7 +57,9 @@ export default function ErrorBoundaryPage({ error, notFoundItem }: Props) {
4657

4758
return (
4859
<ErrorPageBase message="不明なエラーが発生しました." title="不明なエラー">
49-
<Link to="/">ホームへ</Link>
60+
<Button asChild className="mt-5">
61+
<Link to="/">ホームへ</Link>
62+
</Button>
5063
</ErrorPageBase>
5164
);
5265
}

0 commit comments

Comments
 (0)