summaryrefslogtreecommitdiff
path: root/frontend/src/scenes/SplashScreen/index.js
blob: 7b45d20fd109c7d7151e680317eb82e79196f531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Button, Container, Input } from 'rebass';
import { actions } from '../../redux/players';

import HomeLayout from './components/HomeLayout';

class SplashScreen extends Component {
  play = e => {
    if (this._username !== undefined) {
      this.props.chooseUsername(this._username);
    }
  };

  render() {
    return (
      <HomeLayout>
        <Container>
          <Input
            name="username"
            label="Username"
            placeholder="Username"
            hideLabel
            onChange={e => (this._username = e.target.value)}
          />
          <Button backgroundColor="primary" color="white" big onClick={this.play}>
            PLAY NOW!
          </Button>
        </Container>
      </HomeLayout>
    );
  }
}

const mapStateToProps = state => ({});

const mapDispatchToProps = {
  chooseUsername: actions.chooseUsername,
};

export default connect(mapStateToProps, mapDispatchToProps)(SplashScreen);
bgstack15