// @flow import { Classes, InputGroup, Intent } from '@blueprintjs/core'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { actions } from '../../redux/players'; import { IconButton } from '../shared/IconButton'; type ChooseNameFormPresenterProps = { chooseUsername: (username: string) => void, } class ChooseNameFormPresenter extends Component { _username = ''; play = e => { e.preventDefault(); if (this._username !== undefined) { this.props.chooseUsername(this._username); } }; render() { return (
(this._username = e.target.value)} rightElement={this.renderSubmit()} /> ); } renderSubmit = () => ( ); } const mapDispatchToProps = { chooseUsername: actions.chooseUsername, }; export const ChooseNameForm = connect(null, mapDispatchToProps)(ChooseNameFormPresenter);