diff options
Diffstat (limited to 'frontend/src/containers/HomePage/index.js')
-rw-r--r-- | frontend/src/containers/HomePage/index.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/frontend/src/containers/HomePage/index.js b/frontend/src/containers/HomePage/index.js new file mode 100644 index 00000000..c8e33239 --- /dev/null +++ b/frontend/src/containers/HomePage/index.js @@ -0,0 +1,39 @@ +import React, { Component } from 'react' +import { connect } from 'react-redux' +import { Heading, InlineForm } from 'rebass' + +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} + /> + </div> + ) + } +} + +const mapStateToProps = (state) => ({ + +}) + +import { enterGame } from './actions' +const mapDispatchToProps = { + enterGame +} + +export default connect(mapStateToProps, mapDispatchToProps)(HomePage) |