'use strict';

exports.__esModule = true;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _lodashPartial = require('lodash/partial');

var _lodashPartial2 = _interopRequireDefault(_lodashPartial);

var _PickerTop = require('../PickerTop');

var _PickerTop2 = _interopRequireDefault(_PickerTop);

var MonthPickerTop = _react2['default'].createClass({
  displayName: 'MonthPickerTop',

  propTypes: {
    visibleDate: _react.PropTypes.any.isRequired,
    onChangeMode: _react.PropTypes.func.isRequired,
    changeYear: _react.PropTypes.func.isRequired,
    textClassNames: _react.PropTypes.string,
    fixedMode: _react.PropTypes.bool
  },

  changeMode: function changeMode() {
    if (!this.props.fixedMode) {
      this.props.onChangeMode('year');
    }
  },

  render: function render() {
    var year = this.props.visibleDate.year();
    return _react2['default'].createElement(_PickerTop2['default'], {
      fixed: this.props.fixedMode,
      value: year,
      handleClick: this.changeMode,
      previousDate: _lodashPartial2['default'](this.props.changeYear, year - 1),
      nextDate: _lodashPartial2['default'](this.props.changeYear, year + 1),
      valueClassName: this.props.textClassNames
    });
  }
});

exports['default'] = MonthPickerTop;
module.exports = exports['default'];