-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.jsx
163 lines (144 loc) · 4.21 KB
/
index.jsx
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//Data
const BreakDownContent = [
{
"text" : "Amount:",
"main" : "$20,000.00",
"icon" : "fa fa-money"
},
{
"text" : "Shipping Address:",
"main" : "123 Los Olas Blvd, Ste. 101, Fort Lauderdale, FL 33301 USA",
"icon" : "fa fa-map-marker"
},
{
"text" : "Issuer:",
"main" : "Allied Steel Buildings",
"icon" : "fa fa-star-o"
},
{
"text" : "Confirmation No:",
"main" : "878NJDBW8Y9",
"icon" : "fa fa-list-alt"
}
]
// App
class Receipt extends React.Component {
constructor() {
super();
this.state = {
breakdown : {}
}
}
componentWillMount() {
this.setState({
breakdown: BreakDownContent
});
}
render() {
return (<div className="receipt">
<div className="receipt-breakdown">
<div className="receipt-breakdown--header">
<p>Reciept for</p>
<h2>John Smith</h2>
</div>
<ul className="receipt-breakdown--list">
{
Object
.keys(this.state.breakdown)
.map(key => <BreakDownEntry key={key} index={key} details={this.state.breakdown[key]}/>)
}
</ul>
</div>
<Overview product="Customized Steel Building Deposit" merchant={'Allied Steel Buildings'} merchantEmail={'[email protected]'} name={'John'} value={'$20,000.00 USD'}/>
</div>)
}
}
//@TODO Get state into here
class Breakdown extends React.Component {
render() {
return <div className="receipt-breakdown">
<div className="receipt-breakdown--header">
<p>Receipt for</p>
<h2>John Smith</h2>
</div>
<ul>
{
Object
.keys(this.state.breakdown)
.map(key => <BreakDownEntry key={key} index={key} details={this.state.breakdown[key]}/>)
}
</ul>
</div>
}
}
class BreakDownEntry extends React.Component {
render() {
const { details } = this.props;
return <li>
<span className={details.icon}>
</span>
<div className="list-content">
<p>{details.text}
<span className="list-bold">{details.main}</span>
</p>
</div>
</li>
}
}
class Overview extends React.Component {
render() {
return <div className="receipt-overview">
<OverviewHeader logo={'http://www.alliedbuildings.com/wp-content/uploads/2016/11/Allied-Black-Logo.png'}/>
<OverviewBody {...this.props} />
<OverviewFooter {...this.props} />
</div>
}
}
class OverviewHeader extends React.Component {
render() {
return <div className="overview-header">
<img className="logo" src={this.props.logo}/>
<div className="timestamp">
<span>20 Deccember, 2016</span>
<span>08:30:57 EST</span>
</div>
<hr />
</div>
}
}
class PurchaseOverview extends React.Component {
render() {
return <div className="purchase-overview">
<h3>{this.props.product}</h3>
</div>
}
}
class OverviewBody extends React.Component {
render() {
return <div className="overview-body">
<PurchaseOverview {...this.props} />
<div className="user-info">
<p className="user-info-name"> Hello {this.props.name},</p>
<p className="user-info-text"> You sent a payment of <span>{this.props.value}</span> to {this.props.merchant}. (<a href="mailto: [email protected]">{this.props.merchantEmail}</a>). One of our experienced project managers will be in touch with you shortly to review your building specifications.</p>
<p>Thank you for choosing Allied.</p>
<p className="salutation"><img src="http://ec2-52-40-174-59.us-west-2.compute.amazonaws.com/banners/about_us_pic.png"/></p>
</div>
<div className="descriptor">
<p>It may take a few moments for this transaction to appear in your account</p>
</div>
</div>
}
}
class OverviewFooter extends React.Component {
render() {
return <footer className="overview-footer">
<span className="site">
<a href="http://www.alliedbuildings.com/contact-us/" target="_blank">www.allied.build/help</a>
</span>
<span className="invoice-id">
+1.877.94 STEEL
</span>
</footer>
}
}
ReactDOM.render(<Receipt/>, document.getElementById('app'));