Skip to content

Commit

Permalink
Factor out incr/decr lists
Browse files Browse the repository at this point in the history
  • Loading branch information
rod-glover committed Sep 11, 2020
1 parent 5b286fa commit 1a76041
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Tool/Tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import { getLastDateWithDataBefore } from '../../data-services/weather-anomaly-d
// determined by consulting the backend. That's done in `componentDidMount()`.
const latestPossibleDataDate = moment().subtract(15, 'days');

// TODO: Make these props?
const monthIncrDecrBy = [1, 3, 6];
const yearIncrDecrBy = [1, 2, 3, 4, 5, 10];


export default class Tool extends PureComponent {
constructor(props) {
Expand Down Expand Up @@ -129,7 +133,7 @@ export default class Tool extends PureComponent {
disabled={this.state.dataLoading}
id="month-increment"
bsSize="xsmall"
by={[1, 3, 6]}
by={monthIncrDecrBy}
onIncrement={this.handleIncrementMonth}
/>
</Col>
Expand All @@ -150,7 +154,7 @@ export default class Tool extends PureComponent {
disabled={this.state.dataLoading}
id="year-increment"
bsSize="xsmall"
by={[1, 2, 3, 4, 5, 10]}
by={yearIncrDecrBy}
onIncrement={this.handleIncrementYear}
/>
</Col>
Expand Down

0 comments on commit 1a76041

Please sign in to comment.