blowfish/src/components/Account.jsx

32 lines
790 B
React
Raw Normal View History

2019-05-05 13:34:21 +02:00
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
2019-05-06 14:02:49 +02:00
import { openUrl } from '../util/openUrl'
2019-05-06 00:10:28 +02:00
import Balance from './Balance'
2019-05-05 13:34:21 +02:00
2019-05-06 00:10:28 +02:00
export default class Account extends PureComponent {
2019-05-05 13:34:21 +02:00
static propTypes = {
account: PropTypes.shape({
address: PropTypes.string.isRequired,
2019-05-06 18:16:30 +02:00
balance: PropTypes.object.isRequired
2019-05-05 13:34:21 +02:00
})
}
render() {
2019-05-06 00:10:28 +02:00
const { account } = this.props
const { balance, address } = account
2019-05-05 13:34:21 +02:00
return (
2019-05-06 14:02:49 +02:00
<a
onClick={() =>
openUrl(`https://etherscan.io/address/${address}#tokentxns`)
}
title="Click to view on Etherscan"
className="number-unit"
>
<Balance balance={balance} />
2019-05-06 14:02:49 +02:00
<span className="label">{address.substring(0, 12)}...</span>
</a>
2019-05-05 13:34:21 +02:00
)
}
}