import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _defineProperty from "@babel/runtime/helpers/defineProperty";

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Box } from '../box';
import IconButton from '../iconButton';
import { IconArrowLeftMediumOutline, IconArrowRightMediumOutline, IconArrowLeftSmallOutline, IconArrowRightSmallOutline } from '@teamleader/ui-icons';
import theme from './theme.css';
import cx from 'classnames';

var NavigationBar = /*#__PURE__*/function (_PureComponent) {
  _inherits(NavigationBar, _PureComponent);

  var _super = _createSuper(NavigationBar);

  function NavigationBar() {
    var _this;

    _classCallCheck(this, NavigationBar);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));

    _defineProperty(_assertThisInitialized(_this), "handlePreviousClick", function () {
      _this.props.onPreviousClick();
    });

    _defineProperty(_assertThisInitialized(_this), "handleNextClick", function () {
      _this.props.onNextClick();
    });

    return _this;
  }

  _createClass(NavigationBar, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          className = _this$props.className,
          localeUtils = _this$props.localeUtils,
          nextMonth = _this$props.nextMonth,
          previousMonth = _this$props.previousMonth,
          size = _this$props.size,
          withMonthPicker = _this$props.withMonthPicker;
      var months = localeUtils.getMonths();
      var previousMonthButtonLabel = months[previousMonth.getMonth()];
      var nextMonthButtonLabel = months[nextMonth.getMonth()];
      return /*#__PURE__*/React.createElement(Box, {
        className: cx(className, _defineProperty({}, theme['navBar-with-month-picker'], withMonthPicker)),
        display: "flex",
        justifyContent: "space-between"
      }, /*#__PURE__*/React.createElement(IconButton, {
        color: "teal",
        size: size === 'large' ? 'medium' : 'small',
        icon: size === 'large' ? /*#__PURE__*/React.createElement(IconArrowLeftMediumOutline, null) : /*#__PURE__*/React.createElement(IconArrowLeftSmallOutline, null),
        onClick: this.handlePreviousClick,
        title: previousMonthButtonLabel
      }), /*#__PURE__*/React.createElement(IconButton, {
        color: "teal",
        size: size === 'large' ? 'medium' : 'small',
        icon: size === 'large' ? /*#__PURE__*/React.createElement(IconArrowRightMediumOutline, null) : /*#__PURE__*/React.createElement(IconArrowRightSmallOutline, null),
        onClick: this.handleNextClick,
        title: nextMonthButtonLabel
      }));
    }
  }]);

  return NavigationBar;
}(PureComponent);

export default NavigationBar;