Skip to content

Commit

Permalink
Convert '404' page to App Router [#134]
Browse files Browse the repository at this point in the history
Note: file renaming (`404.jsx` -> `not-found.tsx`) is because Next.js
App Router requires the latter name.

Note: old `pages/404.jsx` and `src/pages/404.jsx` are left in place
because the `ListResources` component depends on the `ErrorContainer`
style being exported from them. This will be addressed in a subsequent
commit.
  • Loading branch information
genehack committed Oct 23, 2024
1 parent e5c8997 commit 5caa908
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions static-site/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ReactElement } from "react";

import Splash from "../components/splash";
import styles from "./styles/not-found.module.css";

export default function FourOhFour(): ReactElement {
return (
<>
<div className={styles.errorContainer}>
Oops - that page doesn’t exist! (404).
<br />
Here’s the splash page instead…
</div>

<Splash />
</>
);
}
1 change: 1 addition & 0 deletions static-site/app/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

--blue: #5097ba;
--darkGrey: #333;
--errorRed: #DE3C26;
--mediumGrey: #888;
--lightGrey: #ccc;

Expand Down
10 changes: 10 additions & 0 deletions static-site/app/styles/not-found.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.errorContainer {
color: var(--errorRed);
font-size: 28px;
font-weight: 300;
line-height: calc(1.4 * var(--niceLineHeight));
margin: 0 auto;
max-width: 640px;
padding: 130px 0 80px;
text-align: center;
}

0 comments on commit 5caa908

Please sign in to comment.