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

Convert PrivateKeyImportView component to use JSX (#7522)

This commit is contained in:
Whymarrh Whitby 2019-11-23 12:52:27 -03:30 committed by GitHub
parent 99e94dadbd
commit 9841845b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
import React, { Component } from 'react'
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
@ -44,47 +43,49 @@ function PrivateKeyImportView () {
Component.call(this) Component.call(this)
} }
PrivateKeyImportView.prototype.render = function () { PrivateKeyImportView.prototype.render = function PrivateKeyImportView () {
const { error, displayWarning } = this.props const { error, displayWarning } = this.props
return ( return (
h('div.new-account-import-form__private-key', [ <div className="new-account-import-form__private-key">
<span className="new-account-create-form__instruction">
h('span.new-account-create-form__instruction', this.context.t('pastePrivateKey')), {this.context.t('pastePrivateKey')}
</span>
h('div.new-account-import-form__private-key-password-container', [ <div className="new-account-import-form__private-key-password-container">
<input
h('input.new-account-import-form__input-password', { className="new-account-import-form__input-password"
type: 'password', type="password"
id: 'private-key-box', id="private-key-box"
onKeyPress: e => this.createKeyringOnEnter(e), onKeyPress={e => this.createKeyringOnEnter(e)}
}), />
</div>
]), <div className="new-account-import-form__buttons">
<Button
h('div.new-account-import-form__buttons', {}, [ type="default"
large
h(Button, { className="new-account-create-form__button"
type: 'default', onClick={() => {
large: true,
className: 'new-account-create-form__button',
onClick: () => {
displayWarning(null) displayWarning(null)
this.props.history.push(DEFAULT_ROUTE) this.props.history.push(DEFAULT_ROUTE)
}, }}
}, [this.context.t('cancel')]), >
{this.context.t('cancel')}
h(Button, { </Button>
type: 'secondary', <Button
large: true, type="secondary"
className: 'new-account-create-form__button', large
onClick: () => this.createNewKeychain(), className="new-account-create-form__button"
}, [this.context.t('import')]), onClick={() => this.createNewKeychain()}
>
]), {this.context.t('import')}
</Button>
error ? h('span.error', error) : null, </div>
]) {
error
? <span className="error">{error}</span>
: null
}
</div>
) )
} }