1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Properly handle <enter> keystroke (#7747)

* Properly handle <enter> keystroke, closes #7737

* no-unused-vars
This commit is contained in:
ricky 2020-01-07 17:20:29 -05:00 committed by GitHub
parent c66449f823
commit 984e5a1e26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 30 deletions

View File

@ -1,4 +1,4 @@
import React, { Component } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
@ -24,9 +24,24 @@ const typeHash = {
'first-time': CLASSNAME_FIRST_TIME,
}
export default class Button extends Component {
static propTypes = {
const Button = ({ type, submit, large, children, className, ...buttonProps }) => (
<button
type={submit && 'submit'}
className={classnames(
'button',
typeHash[type] || CLASSNAME_DEFAULT,
large && CLASSNAME_LARGE,
className
)}
{ ...buttonProps }
>
{ children }
</button>
)
Button.propTypes = {
type: PropTypes.string,
submit: PropTypes.bool,
large: PropTypes.bool,
className: PropTypes.string,
children: PropTypes.oneOfType([
@ -36,21 +51,8 @@ export default class Button extends Component {
]),
}
render () {
const { type, large, className, ...buttonProps } = this.props
Button.defaultProps = {
submit: false,
}
return (
<button
className={classnames(
'button',
typeHash[type] || CLASSNAME_DEFAULT,
large && CLASSNAME_LARGE,
className
)}
{ ...buttonProps }
>
{ this.props.children }
</button>
)
}
}
export default Button

View File

@ -297,9 +297,9 @@ export default class ImportWithSeedPhrase extends PureComponent {
</div>
<Button
type="primary"
submit
className="first-time-flow__button"
disabled={!this.isValid() || !termsChecked}
onClick={this.handleImport}
>
{ t('import') }
</Button>