Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / framework / widgets / filter / filter.jsx
1
2 /*
3  * 
4  *   Copyright 2016 RIFT.IO Inc
5  *
6  *   Licensed under the Apache License, Version 2.0 (the "License");
7  *   you may not use this file except in compliance with the License.
8  *   You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *   Unless required by applicable law or agreed to in writing, software
13  *   distributed under the License is distributed on an "AS IS" BASIS,
14  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *   See the License for the specific language governing permissions and
16  *   limitations under the License.
17  *
18  */
19 var React = require('react');
20 var Slider = require('react-slick');
21 // require('../../components/gauge/gauge.js');
22 // require('../../components/text-area/rw.text-area.js');
23 // require('../../components/test/multicomponent.js');
24 import button from '../../components/components.js'
25
26 require('./carousel.css');
27 var SimpleSlider = React.createClass({
28   propTypes: {
29     component_list:           React.PropTypes.array.isRequired,
30     slideno:                  React.PropTypes.number
31   },
32   handleClick: function() {
33     this.setState({});
34   },
35   getInitialState: function() {
36     return {
37       }
38     
39   },
40   shouldComponentUpdate: function(nextProps) {
41
42     if (nextProps.slideno != this.props.slideno) {
43       return true;
44     }
45     return false;
46   },
47   render: function () {
48     // var settings = {
49     //   dots: true,
50     //   infinite: false,
51     //   speed: 500,
52     //   slidesToShow: 1,
53     //   slidesToScroll: 1,
54     //   centerMode: true,
55     //   initialSlide: this.props.slideno || 2
56     // };
57     var settings = {
58         dots: false,
59         infinite: false,
60         speed: 500,
61         slidesToShow: 1,
62         slidesToScroll: 1,
63         centerMode: true,
64         initialSlide: this.props.slideno || 0
65     }
66     setTimeout(function() {
67       window.dispatchEvent(new Event('resize'));
68     }, 1000)
69     var list = [];
70     if (this.props.component_list !== undefined) {
71       for (var i = 0; i < this.props.component_list.length; i++) {
72         list.push(<div key={i}  className={"component"}>{this.props.component_list[i]}</div>);
73       }
74     }
75     return (
76       <div>
77       <Slider {...settings}>
78         {list}
79       </Slider>
80       </div>o
81     );
82   }
83 });
84 module.exports = SimpleSlider;