Skip to content

Commit ff5eca1

Browse files
feat: add 404 page (#172)
* feat: add 404 page * fixup! * add "report an issue" button
1 parent e542329 commit ff5eca1

6 files changed

Lines changed: 390 additions & 309 deletions

File tree

components/Layout.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import HomeLayout from '../layouts/Home/index.jsx';
33
import SponsorsLayout from '../layouts/Sponsors/index.jsx';
44
import BlogLayout from '../layouts/Blog/index.jsx';
55
import PostLayout from '../layouts/Post/index.jsx';
6+
import PageNotFoundLayout from '../layouts/PageNotFound/index.jsx';
67
import '../styles/index.css';
78

89
const LAYOUTS = {
910
home: HomeLayout,
1011
sponsors: SponsorsLayout,
1112
blog: BlogLayout,
1213
post: PostLayout,
14+
404: PageNotFoundLayout,
1315
};
1416

1517
export default function Layout(props) {

layouts/PageNotFound/index.jsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import NavBar from '../../components/NavBar';
2+
import BaseButton from '@node-core/ui-components/Common/BaseButton';
3+
import styles from './index.module.css';
4+
5+
export default ({ metadata }) => {
6+
return (
7+
<>
8+
<NavBar metadata={metadata} />
9+
<main className={styles.container}>
10+
<div className={styles.content}>
11+
<h1 className={styles.errorCode}>404</h1>
12+
<h2 className={styles.title}>Page Not Found</h2>
13+
14+
<p className={styles.description}>
15+
Oops! The page you are looking for might have been moved, deleted,
16+
or was simply never included in the chunk.
17+
</p>
18+
19+
<div className={styles.actions}>
20+
<BaseButton href="/" kind="primary">
21+
Go to Home
22+
</BaseButton>
23+
<BaseButton
24+
href="https://github.com/webpack/webpack-doc-kit/issues/new/choose"
25+
kind="neutral"
26+
>
27+
Report an issue
28+
</BaseButton>
29+
</div>
30+
</div>
31+
</main>
32+
</>
33+
);
34+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
@reference "../../styles/index.css";
2+
3+
.container {
4+
@apply flex
5+
items-center
6+
justify-center
7+
min-h-[calc(100vh-64px)]
8+
px-6
9+
py-20;
10+
}
11+
12+
.content {
13+
@apply flex
14+
flex-col
15+
items-center
16+
text-center
17+
w-full
18+
max-w-2xl
19+
gap-6;
20+
}
21+
22+
.errorCode {
23+
@apply text-8xl
24+
md:text-9xl
25+
font-black
26+
tracking-tighter
27+
text-blue-600
28+
dark:text-blue-500
29+
drop-shadow-sm
30+
leading-none;
31+
}
32+
33+
.title {
34+
@apply text-3xl
35+
md:text-4xl
36+
font-bold
37+
text-neutral-900
38+
dark:text-neutral-50
39+
tracking-tight
40+
p-1;
41+
}
42+
43+
.description {
44+
@apply text-lg
45+
text-neutral-600
46+
dark:text-neutral-400
47+
max-w-lg;
48+
}
49+
50+
.actions {
51+
@apply mt-4
52+
justify-center
53+
items-center
54+
flex
55+
gap-6;
56+
}

0 commit comments

Comments
 (0)