1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/ui/app/components/sender-to-recipient.js

73 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-03-16 21:09:49 +01:00
const { Component } = require('react')
const h = require('react-hyperscript')
const connect = require('react-redux').connect
2018-03-16 21:09:49 +01:00
const PropTypes = require('prop-types')
const Identicon = require('./identicon')
class SenderToRecipient extends Component {
2018-03-20 00:12:09 +01:00
renderRecipientIcon () {
const { recipientAddress } = this.props
return (
recipientAddress
? h(Identicon, { address: recipientAddress, diameter: 20 })
: h('i.fa.fa-file-text-o')
)
}
renderRecipient () {
const { recipientName } = this.props
return (
h('.sender-to-recipient__recipient', [
this.renderRecipientIcon(),
h(
'.sender-to-recipient__name.sender-to-recipient__recipient-name',
recipientName || this.context.t('newContract')
2018-03-20 00:12:09 +01:00
),
])
)
}
2018-03-16 21:09:49 +01:00
render () {
const { senderName, senderAddress } = this.props
return (
h('.sender-to-recipient__container', [
h('.sender-to-recipient__sender', [
h('.sender-to-recipient__sender-icon', [
h(Identicon, {
address: senderAddress,
diameter: 20,
}),
]),
h('.sender-to-recipient__name.sender-to-recipient__sender-name', senderName),
]),
h('.sender-to-recipient__arrow-container', [
h('.sender-to-recipient__arrow-circle', [
h('img', {
height: 15,
width: 15,
2018-03-29 07:30:35 +02:00
src: './images/arrow-right.svg',
2018-03-16 21:09:49 +01:00
}),
]),
]),
2018-03-20 00:12:09 +01:00
this.renderRecipient(),
2018-03-16 21:09:49 +01:00
])
)
}
}
SenderToRecipient.propTypes = {
senderName: PropTypes.string,
senderAddress: PropTypes.string,
recipientName: PropTypes.string,
2018-03-20 00:12:09 +01:00
recipientAddress: PropTypes.string,
2018-03-22 03:18:10 +01:00
t: PropTypes.func,
2018-03-16 21:09:49 +01:00
}
SenderToRecipient.contextTypes = {
t: PropTypes.func,
}
module.exports = connect()(SenderToRecipient)