mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Convert AccountPanel component to use JSX (#7505)
This commit is contained in:
parent
878e0e3164
commit
3d598473a0
@ -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')
|
|
||||||
import Identicon from '../ui/identicon'
|
import Identicon from '../ui/identicon'
|
||||||
const formatBalance = require('../../helpers/utils/util').formatBalance
|
const formatBalance = require('../../helpers/utils/util').formatBalance
|
||||||
const addressSummary = require('../../helpers/utils/util').addressSummary
|
const addressSummary = require('../../helpers/utils/util').addressSummary
|
||||||
@ -33,39 +32,24 @@ AccountPanel.prototype.render = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div
|
||||||
h('.identity-panel.flex-row.flex-space-between', {
|
className="identity-panel flex-row flex-space-between"
|
||||||
style: {
|
style={{ flex: '1 0 auto', cursor: panelState.onClick ? 'pointer' : undefined }}
|
||||||
flex: '1 0 auto',
|
onClick={panelState.onClick}
|
||||||
cursor: panelState.onClick ? 'pointer' : undefined,
|
>
|
||||||
},
|
<div className="identicon-wrapper flex-column select-none">
|
||||||
onClick: panelState.onClick,
|
<Identicon address={panelState.identiconKey} imageify={state.imageifyIdenticons} />
|
||||||
}, [
|
<span className="font-small">{panelState.identiconLabel.substring(0, 7) + '...'}</span>
|
||||||
|
</div>
|
||||||
// account identicon
|
<div className="identity-data flex-column flex-justify-center flex-grow select-none">
|
||||||
h('.identicon-wrapper.flex-column.select-none', [
|
{panelState.attributes.map((attr) => (
|
||||||
h(Identicon, {
|
<div className="flex-row flex-space-between" key={'' + Math.round(Math.random() * 1000000)}>
|
||||||
address: panelState.identiconKey,
|
<label className="font-small no-select">{attr.key}</label>
|
||||||
imageify: state.imageifyIdenticons,
|
<span className="font-small">{attr.value}</span>
|
||||||
}),
|
</div>
|
||||||
h('span.font-small', panelState.identiconLabel.substring(0, 7) + '...'),
|
))}
|
||||||
]),
|
</div>
|
||||||
|
</div>
|
||||||
// account address, balance
|
|
||||||
h('.identity-data.flex-column.flex-justify-center.flex-grow.select-none', [
|
|
||||||
|
|
||||||
panelState.attributes.map((attr) => {
|
|
||||||
return h('.flex-row.flex-space-between', {
|
|
||||||
key: '' + Math.round(Math.random() * 1000000),
|
|
||||||
}, [
|
|
||||||
h('label.font-small.no-select', attr.key),
|
|
||||||
h('span.font-small', attr.value),
|
|
||||||
])
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
|
|
||||||
])
|
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user