Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Timestep component

Choose a tag to compare

@mbarrenechea mbarrenechea released this 20 Jun 11:03
· 228 commits to 61f70f9febffe8af686d14990b7a8ea97394403c since this release

Timestep:

Timestep legend

const layerGroups = require('./mocks').layerGroups;

const LegendListItem = require('./components/legend-list-item').default;
const LegendItemToolbar = require('./components/legend-item-toolbar').default;
const LegendItemTypes = require('./components/legend-item-types').default;
const LegendItemTimestep = require('./components/legend-item-timestep').default;

const timelineConfig = {
  canPlay: true,
  dateFormat: "YYYY",
  interval: "years",
  minDate: "2001-01-01",
  maxDate: "2017-12-31",
  startDate: "2004-09-27",
  endDate: "2010-09-14",
  trimEndDate: "2016-09-14",
  speed: 250,
  step: 1
};


<Legend
  expanded={true}
  sortable={true}
>
  {layerGroups.map((lg, i) => (
    <LegendListItem
      index={i}
      key={lg.dataset}
      layerGroup={lg}
      toolbar={
        <LegendItemToolbar />
      }
    >
      <LegendItemTypes />
      <LegendItemTimestep 
        handleChange={dates => { console.log(dates); }} 
        {...timelineConfig}
      />
    </LegendListItem>
  ))}
</Legend>