-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add custom 404 page to the bike-share example * Move code to error component * Document hasDocument property * Adjust indent * Update page-api.md * Convert spaces to tabs
- Loading branch information
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/react-server-examples/bike-share/components/error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
|
||
export default () => { | ||
return (<div className="error">404 - The page you were looking for was not found.</div>); | ||
}; |
32 changes: 32 additions & 0 deletions
32
packages/react-server-examples/bike-share/pages/not-found.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import {RootElement} from 'react-server'; | ||
|
||
import Header from '../components/header'; | ||
import Footer from '../components/footer'; | ||
import Error from '../components/error'; | ||
|
||
import '../styles/index.scss'; | ||
|
||
export default class NotFoundPage { | ||
handleRoute () { | ||
return {code: 404, hasDocument: true}; | ||
} | ||
|
||
getElements () { | ||
return [ | ||
<RootElement key={0}> | ||
<Header/> | ||
</RootElement>, | ||
<RootElement key={1}> | ||
<Error /> | ||
</RootElement>, | ||
<RootElement key={2}> | ||
<Footer/> | ||
</RootElement>, | ||
] | ||
} | ||
|
||
getBodyClasses() { | ||
return ['page-body']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,7 @@ a { | |
.footer { | ||
padding: 2rem 0rem 0rem; | ||
} | ||
|
||
.error { | ||
color: red; | ||
} |