Skip to content

Commit

Permalink
Add Not Found page
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverroick committed Nov 28, 2024
1 parent ddf6371 commit 54f6e04
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions binderhub/static/js/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "@fontsource/clear-sans/300.css";
import "@fontsource/clear-sans/400.css";
import { HomePage } from "./pages/HomePage.jsx";
import { AboutPage } from "./pages/AboutPage.jsx";
import { NotFoundPage } from "./pages/NotFoundPage.jsx";

export const PAGE_CONFIG = window.pageConfig;

Expand Down Expand Up @@ -83,6 +84,7 @@ export function App() {
/>
}
/>
<Route path="*" element={<NotFoundPage />} />
</Routes>
</div>
</div>
Expand Down
9 changes: 9 additions & 0 deletions binderhub/static/js/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ test("render About page", () => {
expect(screen.queryByText(/This is the about message/)).toBeInTheDocument();
expect(screen.queryByText(/v123.456/)).toBeInTheDocument();
});

test("render Not Found page", () => {
render(
<MemoryRouter initialEntries={["/not-found"]}>
<App />
</MemoryRouter>,
);
expect(screen.queryByText(/Not Found/)).toBeInTheDocument();
});
4 changes: 4 additions & 0 deletions binderhub/static/js/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ a {
font-size: 1rem;
}

.jumbotron {
margin-bottom: 100px;
}

@import "bootstrap-icons/font/bootstrap-icons.css";
20 changes: 20 additions & 0 deletions binderhub/static/js/pages/NotFoundPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export function NotFoundPage() {
return (
<>
<div className="container text-center jumbotron">
<h1>
404: Not Found
</h1>

<p className="lead">
Note: Some errors disappear by refreshing the page.
</p>
</div>
<div className="container">
<div className="row text-center">
<h3>questions?<br/>join the <a href="https://discourse.jupyter.org/c/binder">discussion</a>, read the <a href="https://mybinder.readthedocs.io/en/latest/">docs</a>, see the <a href="https://github.com/jupyterhub/binderhub">code</a></h3>
</div>
</div>
</>
);
}

0 comments on commit 54f6e04

Please sign in to comment.