allow form submit with enter key
This commit is contained in:
parent
ca5d8e15cf
commit
051dcb8454
3 changed files with 8 additions and 5 deletions
|
@ -1,8 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const ButtonPrimary = ({ value, onClickHandler }) => {
|
const ButtonPrimary = ({ value, onClickHandler, type = 'button' }) => {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
type={type}
|
||||||
className={'button button-primary'}
|
className={'button button-primary'}
|
||||||
onClick={onClickHandler}
|
onClick={onClickHandler}
|
||||||
>
|
>
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ChannelCreateForm extends React.Component {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{ !status ? (
|
{ !status ? (
|
||||||
<div>
|
<form onSubmit={this.handleSubmit}>
|
||||||
<ChannelCreateNameInput
|
<ChannelCreateNameInput
|
||||||
value={name.value}
|
value={name.value}
|
||||||
error={name.error}
|
error={name.error}
|
||||||
|
@ -74,10 +74,11 @@ class ChannelCreateForm extends React.Component {
|
||||||
defaultMessage={'Choose a name and password for your channel'}
|
defaultMessage={'Choose a name and password for your channel'}
|
||||||
/>
|
/>
|
||||||
<ButtonPrimary
|
<ButtonPrimary
|
||||||
|
type={'submit'}
|
||||||
value={'Create Channel'}
|
value={'Create Channel'}
|
||||||
onClickHandler={this.handleSubmit}
|
onClickHandler={this.handleSubmit}
|
||||||
/>
|
/>
|
||||||
</div>
|
</form>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<p className={'text--small text--secondary'}>{status}</p>
|
<p className={'text--small text--secondary'}>{status}</p>
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ChannelLoginForm extends React.Component {
|
||||||
}
|
}
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div>
|
<form onSubmit={this.loginToChannel}>
|
||||||
<ChannelLoginNameInput
|
<ChannelLoginNameInput
|
||||||
channelName={this.state.channelName}
|
channelName={this.state.channelName}
|
||||||
handleInput={this.handleInput}
|
handleInput={this.handleInput}
|
||||||
|
@ -63,10 +63,11 @@ class ChannelLoginForm extends React.Component {
|
||||||
defaultMessage={'Enter the name and password for your channel'}
|
defaultMessage={'Enter the name and password for your channel'}
|
||||||
/>
|
/>
|
||||||
<ButtonPrimary
|
<ButtonPrimary
|
||||||
|
type={'submit'}
|
||||||
value={'Authenticate'}
|
value={'Authenticate'}
|
||||||
onClickHandler={this.loginToChannel}
|
onClickHandler={this.loginToChannel}
|
||||||
/>
|
/>
|
||||||
</div>
|
</form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue