Last active
September 14, 2017 17:47
-
-
Save trezy/699024a0f5b59b07854c05eb21ff18da to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Module imports | |
import Link from 'next/link' | |
import React from 'react' | |
// Component imports | |
import Page from '../components/Page' | |
export default class extends React.Component { | |
/***************************************************************************\ | |
Public Methods | |
\***************************************************************************/ | |
static async getInitialProps ({ asPath, isServer, query }) { | |
return Object.assign({ | |
isServer, | |
path: asPath, | |
query, | |
}, query) | |
} | |
render () { | |
let { | |
isServer, | |
path, | |
query, | |
} = this.props | |
return ( | |
<Page | |
isServer={isServer} | |
path={path} | |
query={query} | |
title={this.title}> | |
<section className="hero"> | |
<header> | |
<h1>We Have Fuel. You Don't.</h1> | |
<h2>Any Questions?</h2> | |
</header> | |
<footer className="call-to-action"> | |
<Link href="/get-help"> | |
<a className="button">Get Help</a> | |
</Link> | |
</footer> | |
</section> | |
</Page> | |
) | |
} | |
/***************************************************************************\ | |
Getters | |
\***************************************************************************/ | |
get title () { | |
return 'Home' | |
} | |
} |
This file contains hidden or 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
// Module imports | |
import { bindActionCreators } from 'redux' | |
import { | |
connect, | |
Provider, | |
} from 'react-redux' | |
import React from 'react' | |
// Component imports | |
import { | |
actions, | |
initStore, | |
} from '../store' | |
import Dialog from './Dialog' | |
import LoginDialog from './LoginDialog' | |
import Head from './Head' | |
import Header from './Header' | |
import Reminders from './Reminders' | |
import UserMenu from './UserMenu' | |
const store = initStore() | |
class Page extends React.Component { | |
/***************************************************************************\ | |
Public Methods | |
\***************************************************************************/ | |
componentDidMount () { | |
// this.props.showDialog({ | |
// body: (<LoginDialog />), | |
// closeIsVisible: true, | |
// menuIsVisible: false, | |
// title: 'Login', | |
// }) | |
} | |
render () { | |
let { | |
children, | |
className, | |
isServer, | |
path, | |
query, | |
title, | |
} = this.props | |
let mainClasses = ['fade-in', 'page'].concat(title.toLowerCase().replace(' ', '-')).join(' ') | |
return ( | |
<Provider store={store}> | |
<div role="application"> | |
<Head title={title || this.title} /> | |
<Header | |
isServer={isServer} | |
path={path} /> | |
<UserMenu /> | |
<Reminders /> | |
<main> | |
<div className={mainClasses}> | |
{children} | |
</div> | |
</main> | |
<Dialog /> | |
</div> | |
</Provider> | |
) | |
} | |
/***************************************************************************\ | |
Getters | |
\***************************************************************************/ | |
get title () { | |
return 'Untitled' | |
} | |
} | |
const mapDispatchToProps = dispatch => { | |
return { | |
showDialog: bindActionCreators(actions.showDialog, dispatch), | |
} | |
} | |
export default connect(null, mapDispatchToProps)(Page) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment