Skip to content

Commit

Permalink
feat(Not Found): Add not found page (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
elysee15 authored Aug 20, 2021
1 parent a88ba15 commit 5cdd573
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
30 changes: 30 additions & 0 deletions src/pages/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { makeStyles, Typography } from "@material-ui/core";
import React from "react";
import { Link } from "react-router-dom";

const useStyle = makeStyles(() => ({
container: {
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
textAlign: "center"
}
}));

const NotFound: React.FC = () => {
const classes = useStyle();
return (
<div className={classes.container}>
<Typography variant="h1" style={{ fontWeight: "bold" }}>
404
</Typography>
<Typography variant="h6" gutterBottom>
This page could not be found
</Typography>
<Link to="/">Back to home</Link>
</div>
);
};

export default NotFound;
4 changes: 3 additions & 1 deletion src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import NotFound from "pages/NotFound";
import React, { Suspense } from "react";
import { Route, Switch } from "react-router-dom";

Expand All @@ -9,7 +10,8 @@ const AppRouter: React.FC = () => {
<Suspense fallback="loading...">
<Switch>
<Route path="/secret/:token" exact component={ShowSecret} />
<Route path="/" component={CreateSecret} />
<Route path="/" exact component={CreateSecret} />
<Route path="*" component={NotFound} />
</Switch>
</Suspense>
);
Expand Down

0 comments on commit 5cdd573

Please sign in to comment.