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:
parent
c66449f823
commit
984e5a1e26
@ -1,4 +1,4 @@
|
||||
import React, { Component } from 'react'
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import classnames from 'classnames'
|
||||
|
||||
@ -24,33 +24,35 @@ const typeHash = {
|
||||
'first-time': CLASSNAME_FIRST_TIME,
|
||||
}
|
||||
|
||||
export default class Button extends Component {
|
||||
static propTypes = {
|
||||
type: PropTypes.string,
|
||||
large: PropTypes.bool,
|
||||
className: PropTypes.string,
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.array,
|
||||
PropTypes.element,
|
||||
]),
|
||||
}
|
||||
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>
|
||||
)
|
||||
|
||||
render () {
|
||||
const { type, large, className, ...buttonProps } = this.props
|
||||
|
||||
return (
|
||||
<button
|
||||
className={classnames(
|
||||
'button',
|
||||
typeHash[type] || CLASSNAME_DEFAULT,
|
||||
large && CLASSNAME_LARGE,
|
||||
className
|
||||
)}
|
||||
{ ...buttonProps }
|
||||
>
|
||||
{ this.props.children }
|
||||
</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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user