-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBountyCard.jsx
140 lines (116 loc) · 3.35 KB
/
BountyCard.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
/** @jsx React.DOM */
'use strict'
var React = require('react')
var ReactFireMixin = require('reactfire')
require("./styles/BountyCard.less")
var Avatar = require('./Avatar')
/// Here's where the fun stuff begins...
// Card - Action Buttons
var BountyAction = React.createClass({
handleClickFund: function(event) {
document.body.classList.remove('claim');
document.body.classList.add('funded');
},
handleClickClaim: function(event) {
document.body.classList.remove('funded');
document.body.classList.add('claim');
},
render: function() {
return (
<div className="BountyAction_Wrap">
<div className="BountyAction_Avatar">
</div>
<div className="BountyAction">
<button className="BountyAction_Button BountyAction_Button-Fund" onClick={this.handleClickFund}><span>FUND</span></button>
<button className="BountyAction_Button BountyAction_Button-Claim" onClick={this.handleClickClaim}><span>CLAIM IT</span></button>
</div>
</div>
);
}
});
// Card - Content Block
var BountyContent = React.createClass({
render: function() {
return (
<div className="BountyContent">
<header className="BountyContent_Price">
<h4>Current Bounty</h4>
<h3>
<span>{this.props.price}</span>
</h3>
</header>
<div className="BountyContent_Text" >
{this.props.text}
</div>
</div>
);
}
});
// Card - Header Block
var BountyHeader = React.createClass({
render: function() {
return (
<div className="BountyCard_Header">
<div className="BountyCard_Header-Link">
<a href={this.props.jira} >
View Details
<img src="images/arrow.svg" />
</a>
</div>
<h3 className="BountyCard_Header-Title" >
{this.props.title}
</h3>
</div>
);
}
});
// Card
var BountyCard = React.createClass({
render: function() {
return (
<div className="BountyCard" id={this.props.fid}>
<div className="BountyContent_Flex">
<BountyHeader title={this.props.title} jira={this.props.jira} />
<BountyContent text={this.props.text} price={this.props.price} fname={this.props.contributors} />
</div>
<BountyAction />
</div>
);
}
});
// Wrap around Card - can prolly get rid of this at somepoint...
var BountyCardWrap = React.createClass({
render: function() {
return (
<div className="BountyCardWrap">
{this.props.data.map(function (carddata) {
return (
<BountyCard
title={carddata.title}
text={carddata.text}
price={carddata.price}
jira={carddata.jira}
key={carddata.key}
fid={carddata.fid}
/>
);
})}
</div>
);
}
});
module.exports = React.createClass({
displayName: 'Bounty',
mixins: [ReactFireMixin],
componentWillMount: function() {
this.setState({data: []})
this.bindAsArray(this.props.data, 'data')
},
render: function() {
return (
<div className="BountyContainer">
<BountyCardWrap data={this.state.data} />
</div>
);
}
})