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';
|
||||
|
||||
const ButtonPrimary = ({ value, onClickHandler }) => {
|
||||
const ButtonPrimary = ({ value, onClickHandler, type = 'button' }) => {
|
||||
return (
|
||||
<button
|
||||
type={type}
|
||||
className={'button button-primary'}
|
||||
onClick={onClickHandler}
|
||||
>
|
||||
|
|
|
@ -59,7 +59,7 @@ class ChannelCreateForm extends React.Component {
|
|||
return (
|
||||
<div>
|
||||
{ !status ? (
|
||||
<div>
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
<ChannelCreateNameInput
|
||||
value={name.value}
|
||||
error={name.error}
|
||||
|
@ -74,10 +74,11 @@ class ChannelCreateForm extends React.Component {
|
|||
defaultMessage={'Choose a name and password for your channel'}
|
||||
/>
|
||||
<ButtonPrimary
|
||||
type={'submit'}
|
||||
value={'Create Channel'}
|
||||
onClickHandler={this.handleSubmit}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
<div>
|
||||
<p className={'text--small text--secondary'}>{status}</p>
|
||||
|
|
|
@ -49,7 +49,7 @@ class ChannelLoginForm extends React.Component {
|
|||
}
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={this.loginToChannel}>
|
||||
<ChannelLoginNameInput
|
||||
channelName={this.state.channelName}
|
||||
handleInput={this.handleInput}
|
||||
|
@ -63,10 +63,11 @@ class ChannelLoginForm extends React.Component {
|
|||
defaultMessage={'Enter the name and password for your channel'}
|
||||
/>
|
||||
<ButtonPrimary
|
||||
type={'submit'}
|
||||
value={'Authenticate'}
|
||||
onClickHandler={this.loginToChannel}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue