blob: 030c4489fa2350f28408f49d5d8a39b057f486de (
plain)
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
|
import React, { Component } from 'react';
import './SearchResults.css';
class SearchResult extends Component {
badge(f) {
if (this.props.data.udf[f]) {
return (
<span className="badge">
{this.props.data.udf[f].label}{' '}
</span>
);
} else {
return null;
}
}
image() {
const src = this.props.data['image-url'];
if (src) {
return (<img src={src} alt="" />);
} else {
return null;
}
}
render() {
return (
<div className="Result">
<h3>{this.props.data.name}</h3>
<div className="image">
{this.image()}
</div>
<div className="details">
{this.badge('udf_3')}
{this.badge('udf_2')}
{this.badge('udf_1')}
{this.props.data.childcare ? (<span className="badge">Childcare</span>) : null}
<p>{this.props.data.description}</p>
<p>
<span className="label">Day</span>: {this.props.data.meetingDay.label}{" "}
<span className="label">Time</span>: {this.props.data.meetingTime.label}{" "}
<span className="label">Location</span>: {this.props.data.area.label}
</p>
</div>
</div>
);
}
}
class SearchResults extends Component {
render() {
let results = this.props.results.map((result) => {
return (
<SearchResult key={result.id} data={result}></SearchResult>
);
});
return (
<div className="SearchResults">
<p className="result-count">Found {results.length} groups</p>
{results}
</div>
);
}
}
export default SearchResults;
|