-
Notifications
You must be signed in to change notification settings - Fork 503
/
index.js
54 lines (47 loc) · 1.74 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import React from 'react'
import PropTypes from 'prop-types'
import { FormattedMessage } from 'react-intl'
import styled from 'styled-components'
import { Banner } from 'blockchain-info-components'
const LabelContainer = styled.div`
margin-top: 5px;
`
const PartnerBanner = styled(Banner)`
padding: 3px 5px;
`
const PartnerLabel = props => {
const { txType, partnerLabel, buysellPartner } = props
if (partnerLabel === 'shift') {
return (
<LabelContainer mobileSize='14px' size='16px' weight={500} color={props.type} uppercase>
<PartnerBanner>
{
txType === 'sent'
? <FormattedMessage id='components.txlistitem.partnerlabel.depositedshapeshift' defaultMessage='ShapeShift Deposit' />
: <FormattedMessage id='components.txlistitem.partnerlabel.receivedshapeshift' defaultMessage='Received from ShapeShift' />
}
</PartnerBanner>
</LabelContainer>
)
}
if (partnerLabel === 'buy-sell' && buysellPartner) {
return (
<LabelContainer mobileSize='14px' size='16px' weight={500} color={props.type} uppercase>
<PartnerBanner partnerLabel>
{
txType === 'sent'
? <FormattedMessage id='components.txlistitem.partnerlabel.soldvia' defaultMessage='Sold via {partner}' values={{ partner: buysellPartner }} />
: <FormattedMessage id='components.txlistitem.partnerlabel.boughtvia' defaultMessage='Bought via {partner}' values={{ partner: buysellPartner }} />
}
</PartnerBanner>
</LabelContainer>
)
}
return null
}
PartnerLabel.propTypes = {
txHash: PropTypes.string.isRequired,
txType: PropTypes.string.isRequired,
buysellPartner: PropTypes.string
}
export default PartnerLabel