Skip to content

Commit 1e10b0a

Browse files
authored
Merge pull request #10 from heithemmoumni/master
feat: add not found page
2 parents 2f4ae4b + fddc76c commit 1e10b0a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/components/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Blogs from '../routes/blogs';
99
import Blog from '../routes/blog';
1010
import Contact from '../routes/contact';
1111
import ContactSuccess from '../routes/contact-success';
12+
import NotFoundPage from '../routes/notfound';
1213

1314
export default class App extends Component {
1415

@@ -31,6 +32,7 @@ export default class App extends Component {
3132
<Blog path="/blog/:name" />
3233
<Contact path="/contact/" />
3334
<ContactSuccess path="/contact/success" />
35+
<NotFoundPage type="404" default />
3436
</Router>
3537
</div>
3638
</Provider>

src/routes/notfound/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { h } from 'preact';
2+
import style from './style';
3+
import { Link } from 'preact-router/match';
4+
5+
const Notfound = () => {
6+
7+
return (
8+
<div class={style.notfound}>
9+
<h1>Error 404</h1>
10+
<p>That page doesn't exist.</p>
11+
<Link href="/"><h4>Back to Home</h4></Link>
12+
</div>
13+
)
14+
}
15+
16+
export default Notfound;

src/routes/notfound/style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.notfound {
2+
padding: 0 5%;
3+
}

0 commit comments

Comments
 (0)