diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2019-05-05 20:31:41 +0200 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-05-06 18:33:15 +0200 |
commit | 664f7a98b44a561d619cc14235335e2a6f2bceb3 (patch) | |
tree | fd1c26ccd24b4dee26a2d412f8bdd4ba61b6fe42 /frontend/src/components/game-browser/GameBrowser.jsx | |
parent | Convert game components to TypeScript (diff) | |
download | seven-wonders-664f7a98b44a561d619cc14235335e2a6f2bceb3.tar.gz seven-wonders-664f7a98b44a561d619cc14235335e2a6f2bceb3.tar.bz2 seven-wonders-664f7a98b44a561d619cc14235335e2a6f2bceb3.zip |
Migrate game-browser components to TypeScript
Diffstat (limited to 'frontend/src/components/game-browser/GameBrowser.jsx')
-rw-r--r-- | frontend/src/components/game-browser/GameBrowser.jsx | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/frontend/src/components/game-browser/GameBrowser.jsx b/frontend/src/components/game-browser/GameBrowser.jsx deleted file mode 100644 index cfa0e45e..00000000 --- a/frontend/src/components/game-browser/GameBrowser.jsx +++ /dev/null @@ -1,53 +0,0 @@ -// @flow -import { Button, Classes, InputGroup, Intent } from '@blueprintjs/core'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { Flex } from 'reflexbox'; -import { actions } from '../../redux/actions/lobby'; -import { GameList } from './GameList'; -import { PlayerInfo } from './PlayerInfo'; - -type GameBrowserProps = { - createGame: (gameName: string) => void, -} - -class GameBrowserPresenter extends Component<GameBrowserProps> { - - _gameName: string | void = undefined; - - createGame = (e: SyntheticEvent<*>): void => { - e.preventDefault(); - if (this._gameName !== undefined) { - this.props.createGame(this._gameName); - } - }; - - render() { - return ( - <div> - <Flex align="center" justify='space-between' p={1}> - <form onSubmit={this.createGame}> - <InputGroup - placeholder="Game name" - name="game_name" - onChange={(e: SyntheticInputEvent<*>) => (this._gameName = e.target.value)} - rightElement={<CreateGameButton onClick={this.createGame}/>} - /> - </form> - <PlayerInfo /> - </Flex> - <GameList /> - </div> - ); - } -} - -const CreateGameButton = ({onClick}) => ( - <Button className={Classes.MINIMAL} intent={Intent.PRIMARY} icon='add' onClick={onClick} /> -); - -const mapDispatchToProps = { - createGame: actions.requestCreateGame, -}; - -export const GameBrowser = connect(null, mapDispatchToProps)(GameBrowserPresenter); |