1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

Merge pull request #978 from oceanprotocol/issue-968-resolve-404

Add a check before rendering 404
This commit is contained in:
Akshay 2022-05-09 11:37:11 +02:00 committed by GitHub
commit e23d46b8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,8 @@ const tag = 'ocean'
export default class NotFoundPage extends Component { export default class NotFoundPage extends Component {
state = { gif: '' } state = { gif: '' }
browser = typeof window !== 'undefined' && window
static propTypes = { static propTypes = {
location: PropTypes.object location: PropTypes.object
} }
@ -45,27 +47,31 @@ export default class NotFoundPage extends Component {
render() { render() {
return ( return (
<> <>
<Seo location={this.props.location} title="404 - Not Found" /> {this.browser && (
<Layout location={this.props.location}> <>
<Content> <Seo location={this.props.location} title="404 - Not Found" />
<article className={styles.content}> <Layout location={this.props.location}>
<h1>Page not found.</h1> <Content>
<p> <article className={styles.content}>
You just hit a route that doesn&#39;t exist... the sadness. <h1>Page not found.</h1>
Check your url, <Link to="/">go back to the homepage</Link>, or <p>
check out some <em>{tag}</em> gifs, entirely your choice. You just hit a route that doesn&#39;t exist... the sadness.
</p> Check your url, <Link to="/">go back to the homepage</Link>,
or check out some <em>{tag}</em> gifs, entirely your choice.
</p>
<video className="gif" src={this.state.gif} autoPlay loop /> <video className="gif" src={this.state.gif} autoPlay loop />
<div> <div>
<button <button
onClick={this.handleClick} onClick={this.handleClick}
>{`Get another ${tag} gif`}</button> >{`Get another ${tag} gif`}</button>
</div> </div>
</article> </article>
</Content> </Content>
</Layout> </Layout>
</>
)}
</> </>
) )
} }