"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));

var _react = _interopRequireWildcard(require("react"));

var _Button = _interopRequireDefault(require("../button/Button"));

var _enum = require("../button/enum");

var Pager = /*#__PURE__*/function (_PureComponent) {
  (0, _inherits2["default"])(Pager, _PureComponent);

  var _super = (0, _createSuper2["default"])(Pager);

  function Pager() {
    var _this;

    (0, _classCallCheck2["default"])(this, Pager);
    _this = _super.apply(this, arguments);

    _this.handleClick = function () {
      var _this$props = _this.props,
          page = _this$props.page,
          onClick = _this$props.onClick;

      if (onClick) {
        onClick(page);
      }
    };

    return _this;
  }

  (0, _createClass2["default"])(Pager, [{
    key: "render",
    value: function render() {
      var _this$props2 = this.props,
          active = _this$props2.active,
          renderer = _this$props2.renderer,
          page = _this$props2.page,
          type = _this$props2.type,
          disabled = _this$props2.disabled,
          className = _this$props2.className;
      return /*#__PURE__*/_react["default"].createElement(_Button["default"], {
        className: className,
        funcType: active ? _enum.FuncType.raised : _enum.FuncType.flat,
        onClick: this.handleClick,
        color: active ? _enum.ButtonColor.primary : undefined,
        disabled: disabled
      }, renderer(page, type));
    }
  }]);
  return Pager;
}(_react.PureComponent);

exports["default"] = Pager;
Pager.displayName = 'Pager';
//# sourceMappingURL=Pager.js.map
