forked from garris/BackstopJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocationList.js
33 lines (24 loc) · 943 Bytes
/
LocationList.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
const React = require('react');
const LocationItem = require('./LocationItem');
const LocationList = React.createClass({
render() {
const self = this;
const locations = this.props.locations.map(function (l) {
const active = self.props.activeLocationAddress == l.address;
// Notice that we are passing the onClick callback of this
// LocationList to each LocationItem.
return <LocationItem address={l.address} timestamp={l.timestamp}
active={active} onClick={self.props.onClick}/>;
});
if (!locations.length) {
return null;
}
return (
<div className="list-group col-xs-12 col-md-6 col-md-offset-3">
<span className="list-group-item active">Saved Locations</span>
{locations}
</div>
);
}
});
module.exports = LocationList;