From 56b86778278e05fda0abd0a0fc61d41231a7a525 Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Tue, 8 Jan 2019 12:23:13 +0000 Subject: [PATCH] clean component interfaces --- src/components/Dashboard.jsx | 1 - src/components/Map.jsx | 18 ++++++++++-------- src/components/Timeline.jsx | 10 +++++++++- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/components/Dashboard.jsx b/src/components/Dashboard.jsx index 18a77f6..077e0f2 100644 --- a/src/components/Dashboard.jsx +++ b/src/components/Dashboard.jsx @@ -103,7 +103,6 @@ class Dashboard extends React.Component { }} /> for each location. - * A location consists of an array of events (location.events). The function + * A location consists of an array of events (see selectors). The function * also has full access to the domain and redux state to derive values if - * necessary. The function should return a regular style object. + * necessary. The function should return an array, where the value at the + * first index is a styles object for the SVG at the location, and the value + * at the second index is an optional function that renders additional + * components in the div. */ styleLocation(location) { return [ { fill: 'orange' }, - () => ciao ] } @@ -217,8 +219,8 @@ class Map extends React.Component { return (
-
- {(this.map !== null) ? this.renderSVG() : ''} +
+ {(this.map !== null) ? this.renderTiles() : ''} {(this.map !== null) ? this.renderMarkers() : ''} {(this.map !== null) && isShowingSites ? this.renderSites() : ''} {(this.map !== null) ? this.renderEvents() : ''} diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 7f9bb2e..4accb68 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -211,10 +211,18 @@ class Timeline extends React.Component { this.props.methods.onUpdateTimerange(this.state.timerange); } + /** + * Determines additional styles on the for each location. + * A datetime consists of an array of events (see selectors). The function + * also has full access to the domain and redux state to derive values if + * necessary. The function should return an array, where the value at the + * first index is a styles object for the SVG at the location, and the value + * at the second index is an optional function that renders additional + * components in the div. + */ styleDatetime(timestamp) { return [ { fill: 'orange' }, - () => ciao ] }