-
Notifications
You must be signed in to change notification settings - Fork 503
/
template.success.js
94 lines (87 loc) · 3.36 KB
/
template.success.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import React, { Fragment } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import { FormattedMessage } from 'react-intl'
import { reduxForm } from 'redux-form'
import CopyToClipBoard from 'react-copy-to-clipboard'
import { Button, Link, Text } from 'blockchain-info-components'
import { Form } from 'components/Form'
import CoinDisplay from 'components/Display/CoinDisplay'
import FiatDisplay from 'components/Display/FiatDisplay'
const Container = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20px 0;
margin-top: 5px;
margin-bottom: 20px;
background-color: ${props => props.theme['white-blue']};
& > * { padding: 5px 0; }
`
const LinkContainer = styled.div`
width: 100%;
margin-top: 20px;
box-sizing: border-box;
padding: 20px 15px 0px 15px;
text-align: center;
word-wrap: break-word;
border-top: 1px solid ${props => props.theme['gray-1']};
`
const SubHeader = styled(Text)`
margin-bottom: 20px;
`
const Footer = styled.div`
margin-top: 20px;
`
const SecondStep = (props) => {
const { previousStep, position, total, modalActions, ...rest } = props
const { handleSubmit, satoshis, message, link, active } = rest
return (
<Fragment>
<Form onSubmit={handleSubmit}>
<SubHeader size='14px' weight={300}>
<FormattedMessage id='modals.requestbitcoin.secondstep.explain' defaultMessage='Send the link below to your friend or contact and they will be able to send bitcoin directly to your wallet.' />
</SubHeader>
<Text size='14px' weight={500}>
<FormattedMessage id='modals.requestbitcoin.secondstep.payment' defaultMessage='Payment Request:' />
</Text>
<Container>
<CoinDisplay size='28px' weight={500} color='received' coin='BTC'>{satoshis}</CoinDisplay>
<FiatDisplay size='20px' weight={300} color='received' coin='BTC'>{satoshis}</FiatDisplay>
<Text size='16px'>
<FormattedMessage id='modals.requestbitcoin.secondstep.message' defaultMessage='For "{message}"' values={{message: message}} />
</Text>
<LinkContainer>
<Text size='12px' weight={300}>{link}</Text>
</LinkContainer>
</Container>
<CopyToClipBoard text={link}>
<Button type='submit' nature={active ? 'copy' : 'primary'} fullwidth uppercase>
{ active
? <FormattedMessage id='modals.requestbitcoin.secondstep.copied' defaultMessage='Copied!' />
: <FormattedMessage id='modals.requestbitcoin.secondstep.copy' defaultMessage='Copy link' />
}
</Button>
</CopyToClipBoard>
</Form>
<Footer>
<Link onClick={previousStep} size='13px' weight={300}>
<FormattedMessage id='scenes.requestbitcoin.secondstep.back' defaultMessage='Go Back' />
</Link>
</Footer>
</Fragment>
)
}
SecondStep.propTypes = {
position: PropTypes.number.isRequired,
total: PropTypes.number.isRequired,
closeAll: PropTypes.func.isRequired,
active: PropTypes.bool.isRequired,
satoshis: PropTypes.string.isRequired,
link: PropTypes.string.isRequired,
message: PropTypes.string.isRequired,
previousStep: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired
}
export default reduxForm({ form: 'requestBitcoin', destroyOnUnmount: false })(SecondStep)