You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
carbon/pages/index.js

47 lines
1.1 KiB
JavaScript

// Theirs
import React from 'react'
import { withRouter } from 'next/router'
import Either from 'eitherx'
// Ours
import EditorContainer from '../components/EditorContainer'
import Page from '../components/Page'
6 years ago
import { MetaLinks } from '../components/Meta'
class Index extends React.Component {
componentDidMount() {
if (window.workbox && window.workbox.register) {
window.workbox.register()
}
}
componentWillUnmount() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister()
})
}
}
shouldComponentUpdate = () => false
render() {
return (
<Page enableHeroText={true} flex={true}>
6 years ago
<MetaLinks />
<Either>
<EditorContainer router={this.props.router} snippet={this.props.snippet} />
<p>
An unexpected error has occurred. Please{' '}
<u>
<a href="https://github.com/carbon-app/carbon">file an issue here</a>
</u>
.
</p>
</Either>
</Page>
)
}
}
export default withRouter(Index)