-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomparables.js
More file actions
86 lines (79 loc) · 2.07 KB
/
Copy pathcomparables.js
File metadata and controls
86 lines (79 loc) · 2.07 KB
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
import React from 'react';
import _ from 'lodash';
import { connect } from 'react-redux';
import { Link } from 'react-router';
//components
import BackButton from './backbutton';
import RemoveComparableBtn from './removecomparablebtn';
const Comparables = React.createClass({
render: function(){
var comparables = this.props.state['comparables'];
return(
<div style={{ marginTop: "75px"}}>
<BackButton />
<div style={{marginTop:"30px"}}>
<table className="w3-table w3-striped w3-bordered w3-card">
<TableHead />
<TableBody comparables={comparables} />
</table>
</div>
</div>
);
}
});
const TableHead = React.createClass({
render: function(){
return(
<thead>
<tr className="w3-teal">
<th>Type</th>
<th>Monthly rent</th>
<th>County</th>
<th>Location</th>
<th> Actions </th>
</tr>
</thead>
);
}
});
const TableBody = React.createClass({
render: function(){
var comparableItems = _.map(this.props.comparables, comparable => <ComparableItem key={comparable.id} comparable={comparable} />);
return(
<tbody>
{ comparableItems }
</tbody>
);
}
});
const ComparableItem = React.createClass({
render: function(){
return(
<tr>
<td> { this.props.comparable.sdtype } </td>
<td> { this.props.comparable.rent } </td>
<td> { this.props.comparable.county } </td>
<td> { this.props.comparable.location } </td>
<td>
<div className="w3-row">
<div className="w3-half">
<Link to={`/apartment/${this.props.comparable.id}/`} className="w3-btn w3-teal w3-small" onMouseOver={ this.animateCard }>
<i className="fa fa-location-arrow" aria-hidden="true"></i>
Go to apartment
</Link>
</div>
<div className="w3-half">
<RemoveComparableBtn id={ this.props.comparable.id } />
</div>
</div>
</td>
</tr>
);
}
});
const mapStateToProps = (state) => {
return{
state: state
}
}
export default connect(mapStateToProps)(Comparables);