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 PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
@ -24,23 +24,9 @@ const typeHash = {
'first-time': CLASSNAME_FIRST_TIME, 'first-time': CLASSNAME_FIRST_TIME,
} }
export default class Button extends Component { const Button = ({ type, submit, large, children, className, ...buttonProps }) => (
static propTypes = {
type: PropTypes.string,
large: PropTypes.bool,
className: PropTypes.string,
children: PropTypes.oneOfType([
PropTypes.string,
PropTypes.array,
PropTypes.element,
]),
}
render () {
const { type, large, className, ...buttonProps } = this.props
return (
<button <button
type={submit && 'submit'}
className={classnames( className={classnames(
'button', 'button',
typeHash[type] || CLASSNAME_DEFAULT, typeHash[type] || CLASSNAME_DEFAULT,
@ -49,8 +35,24 @@ export default class Button extends Component {
)} )}
{ ...buttonProps } { ...buttonProps }
> >
{ this.props.children } { children }
</button> </button>
) )
}
Button.propTypes = {
type: PropTypes.string,
submit: PropTypes.bool,
large: PropTypes.bool,
className: PropTypes.string,
children: PropTypes.oneOfType([
PropTypes.string,
PropTypes.array,
PropTypes.element,
]),
} }
Button.defaultProps = {
submit: false,
}
export default Button

View File

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