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

Convert AccountImportSubview to use JSX (#7520)

This commit is contained in:
Whymarrh Whitby 2019-11-23 00:44:12 -03:30 committed by GitHub
parent d7fabae847
commit 1454426e3e
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 Component = require('react').Component
const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const connect = require('react-redux').connect
import Select from 'react-select'
@ -35,47 +34,44 @@ AccountImportSubview.prototype.render = function () {
const { type } = state
return (
h('div.new-account-import-form', [
h('.new-account-import-disclaimer', [
h('span', this.context.t('importAccountMsg')),
h('span', {
style: {
<div className="new-account-import-form">
<div className="new-account-import-disclaimer">
<span>{this.context.t('importAccountMsg')}</span>
<span
style={{
cursor: 'pointer',
textDecoration: 'underline',
},
onClick: () => {
}}
onClick={() => {
global.platform.openWindow({
url: 'https://metamask.zendesk.com/hc/en-us/articles/360015289932',
})
},
}, this.context.t('here')),
]),
h('div.new-account-import-form__select-section', [
h('div.new-account-import-form__select-label', this.context.t('selectType')),
h(Select, {
className: 'new-account-import-form__select',
name: 'import-type-select',
clearable: false,
value: type || menuItems[0],
options: menuItems.map((type) => {
}}>
{this.context.t('here')}
</span>
</div>
<div className="new-account-import-form__select-section">
<div className="new-account-import-form__select-label">
{this.context.t('selectType')}
</div>
<Select
className="new-account-import-form__select"
name="import-type-select"
clearable={false}
value={type || menuItems[0]}
options={menuItems.map((type) => {
return {
value: type,
label: type,
}
}),
onChange: (opt) => {
})}
onChange={(opt) => {
this.setState({ type: opt.value })
},
}),
]),
this.renderImportView(),
])
}}
/>
</div>
{this.renderImportView()}
</div>
)
}
@ -87,10 +83,10 @@ AccountImportSubview.prototype.renderImportView = function () {
switch (current) {
case this.context.t('privateKey'):
return h(PrivateKeyImportView)
return <PrivateKeyImportView />
case this.context.t('jsonFile'):
return h(JsonImportView)
return <JsonImportView />
default:
return h(JsonImportView)
return <JsonImportView />
}
}