on 04765bb help sign in
bridge/src/components/old/PointList.js
32 lines 807 B history raw
1import React from 'react';
2import { chunk } from 'lodash';
4import { usePointCursor } from '../../store/pointCursor';
6import { Row } from './Base';
7import RenderedPoint from './RenderedPoint';
9const PointList = function(props) {
10 const { setPointCursor } = usePointCursor();
11 const { routeHandler, points, loading } = props;
12 const chunks = chunk(points, 3);
14 return points.length === 0 ? (
15 <p>{loading ? 'Loading...' : 'No points to display'}</p>
16 ) : (
17 chunks.map((chunk, idx) => (
18 <Row key={`render-row-${idx}`}>
19 {chunk.map(point => (
20 <RenderedPoint
21 key={point}
22 setPointCursor={setPointCursor}
23 routeHandler={routeHandler}
24 point={point}
25 />
26 ))}
27 </Row>
28 ))
29 );
30};
32export default PointList;