import React, { Component } from 'react'
import cx from 'classnames'
import { equals } from 'ramda'

class MTRangePickerQuickSelect extends Component {
  constructor (props) {
    super(props)
    this.setDates = this.setDates.bind(this)
  }

  setDates () {
    this.props.updateValues(this.props.nextRange)
  }

  render () {
    const classes = cx(this.props.className, {
      'is-active': equals(this.props.nextRange, this.props.currentRange),
    })

    return <li className={ classes } onClick={ this.setDates }>{ this.props.label }</li>
  }
}

export default MTRangePickerQuickSelect
