-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchBox.jsx
63 lines (54 loc) · 1.99 KB
/
searchBox.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
'use strict';
var React = require('react'),
ReactDOM = require('react-dom');
// Components
var Header = require('./components/Header/header.jsx'),
Slider = require('./components/Slider/slider.jsx'),
Search = require('./components/Search/search.jsx'),
ReviewsSummary = require('./components/ReviewsSummary/reviewsSummary.jsx'),
Facilities = require('./components/Facilities/facilities.jsx'),
Map = require('./components/Map/map.jsx');
// Data
var data = require('./dummyData.json');
var RoomPage = React.createClass({
getInitialState: function () {
return {
searchResults: null
};
},
setSearchResults: function (searchResults) {
this.setState({
searchResults: searchResults
});
},
render: function () {
var searchResults;
if(this.state.searchResults) {
searchResults = (
<section className="searchResults well text-center">
Search results will be here...
</section>
);
} else {
searchResults = '';
}
return (
<div className="container">
<Header data={data.hotelInfo}/>
<section className="searchContainer clearfix">
<div className="searchContainer__left col-xs-12 col-md-8">
<Slider data={data.slider} />
<Search data={data.offerWebsites} setSearchResults={this.setSearchResults}/>
</div>
<div className="searchContainer__right col-xs-12 col-md-4">
<ReviewsSummary />
<Facilities data={data.facilities}/>
<Map mapUrl={data.hotelInfo.mapUrl}/>
</div>
</section>
{searchResults}
</div>
);
}
});
ReactDOM.render(<RoomPage />, document.getElementById('RoomPageReact'));