diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-01-20 23:18:57 +0100 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-01-20 23:25:26 +0100 |
commit | cc3db2982dc22899a9ebea21e8a8dfbfd710f842 (patch) | |
tree | d8e138b300a8d8fded0651ac6be204d8c3342e68 /frontend/src/containers/home.js | |
parent | Remove shitty code and move generator stars to the right (diff) | |
download | seven-wonders-cc3db2982dc22899a9ebea21e8a8dfbfd710f842.tar.gz seven-wonders-cc3db2982dc22899a9ebea21e8a8dfbfd710f842.tar.bz2 seven-wonders-cc3db2982dc22899a9ebea21e8a8dfbfd710f842.zip |
DUCKS! Refactor front architecture
Diffstat (limited to 'frontend/src/containers/home.js')
-rw-r--r-- | frontend/src/containers/home.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/frontend/src/containers/home.js b/frontend/src/containers/home.js new file mode 100644 index 00000000..ce1b69fd --- /dev/null +++ b/frontend/src/containers/home.js @@ -0,0 +1,40 @@ +import React, { Component } from 'react' +import { connect } from 'react-redux' +import { Heading, InlineForm } from 'rebass' +import { Link } from 'react-router' +class HomePage extends Component { + + play = (e) => { + e.preventDefault() + if (this._username !== undefined) { + this.props.enterGame(this._username) + } + } + + render() { + return ( + <div> + <Heading>Enter your username to start playing!</Heading> + <InlineForm + buttonLabel="Play now!" + label="Username" + name="username" + onChange={(e) => this._username = e.target.value} + onClick={this.play} + /> + <Link to="/somewhere">Take me somewhere</Link> + </div> + ) + } +} + +const mapStateToProps = (state) => ({ + +}) + +import { actions } from '../redux/game' +const mapDispatchToProps = { + enterGame: actions.enterGame +} + +export default connect(mapStateToProps, mapDispatchToProps)(HomePage) |