summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chabbert <chabbertvi@eisti.eu>2017-08-08 00:18:06 +0200
committerVictor Chabbert <chabbertvi@eisti.eu>2017-08-08 00:18:06 +0200
commita3d113f35e6f4d429fb9a0c65dc23375dba0b38b (patch)
tree0267481afeeae628484982499f64efbdfa76fe60
parentAdd blueprint js library (diff)
downloadseven-wonders-a3d113f35e6f4d429fb9a0c65dc23375dba0b38b.tar.gz
seven-wonders-a3d113f35e6f4d429fb9a0c65dc23375dba0b38b.tar.bz2
seven-wonders-a3d113f35e6f4d429fb9a0c65dc23375dba0b38b.zip
Change username input to use blueprint
-rw-r--r--frontend/src/scenes/SplashScreen/index.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/frontend/src/scenes/SplashScreen/index.js b/frontend/src/scenes/SplashScreen/index.js
index 7b45d20f..feff8b1e 100644
--- a/frontend/src/scenes/SplashScreen/index.js
+++ b/frontend/src/scenes/SplashScreen/index.js
@@ -1,12 +1,17 @@
+// @flow
import React, { Component } from 'react';
import { connect } from 'react-redux';
-import { Button, Container, Input } from 'rebass';
+import { Container } from 'rebass';
import { actions } from '../../redux/players';
+import { InputGroup, Button, Classes, Intent } from '@blueprintjs/core';
import HomeLayout from './components/HomeLayout';
class SplashScreen extends Component {
+ _username = '';
+
play = e => {
+ e.preventDefault();
if (this._username !== undefined) {
this.props.chooseUsername(this._username);
}
@@ -16,26 +21,25 @@ class SplashScreen extends Component {
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>
+ <form onSubmit={this.play}>
+ <InputGroup
+ placeholder="Username"
+ onChange={e => (this._username = e.target.value)}
+ rightElement={this.renderSubmit()}
+ />
+ </form>
</Container>
</HomeLayout>
);
}
-}
-const mapStateToProps = state => ({});
+ renderSubmit = () => (
+ <Button className={Classes.MINIMAL} onClick={this.play} intent={Intent.PRIMARY} rightIconName="arrow-right" />
+ );
+}
const mapDispatchToProps = {
chooseUsername: actions.chooseUsername,
};
-export default connect(mapStateToProps, mapDispatchToProps)(SplashScreen);
+export default connect(null, mapDispatchToProps)(SplashScreen);
bgstack15