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,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
|
||||
|
@ -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