-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathchart_viewer.jsx
More file actions
54 lines (50 loc) · 1.5 KB
/
chart_viewer.jsx
File metadata and controls
54 lines (50 loc) · 1.5 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
import React, { PropTypes } from 'react';
import Slider from 'react-slick';
import '/node_modules/slick-carousel/slick/slick.css';
import '/node_modules/slick-carousel/slick/slick-theme.css';
import DataVisualisation from '../data_visualisation';
import NavButton from './nav_button.jsx';
const ChartViewer = ({ dashboard, charts, meteorMethodCall, routeTo, setChartViewerState }) => {
if (!charts) return null;
const settings = {
className: 'slider-item',
adaptiveHeight: true,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: <NavButton />,
nextArrow: <NavButton right />,
};
return (
<div
className="chart-viewer anchor-for-click"
onClick={e => /anchor-for-click/.test(e.target.className) && setChartViewerState(false)}
>
<div>
<Slider {...settings}>
{charts.map(chart => (
<div key={chart._id}>
<DataVisualisation
chart={chart}
dashboardId={dashboard._id}
meteorMethodCall={meteorMethodCall}
routeTo={routeTo}
maxHeight={140}
heightIsFixed
/>
</div>
))}
</Slider>
</div>
</div>
);
};
ChartViewer.propTypes = {
dashboard: PropTypes.object,
charts: PropTypes.object,
meteorMethodCall: PropTypes.func.isRequired,
routeTo: PropTypes.func.isRequired,
setChartViewerState: PropTypes.func.isRequired,
};
export default ChartViewer;