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,33 +24,35 @@ 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 = { <button
type: PropTypes.string, type={submit && 'submit'}
large: PropTypes.bool, className={classnames(
className: PropTypes.string, 'button',
children: PropTypes.oneOfType([ typeHash[type] || CLASSNAME_DEFAULT,
PropTypes.string, large && CLASSNAME_LARGE,
PropTypes.array, className
PropTypes.element, )}
]), { ...buttonProps }
} >
{ children }
</button>
)
render () { Button.propTypes = {
const { type, large, className, ...buttonProps } = this.props type: PropTypes.string,
submit: PropTypes.bool,
return ( large: PropTypes.bool,
<button className: PropTypes.string,
className={classnames( children: PropTypes.oneOfType([
'button', PropTypes.string,
typeHash[type] || CLASSNAME_DEFAULT, PropTypes.array,
large && CLASSNAME_LARGE, PropTypes.element,
className ]),
)}
{ ...buttonProps }
>
{ this.props.children }
</button>
)
}
} }
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>