"use strict";

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

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

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

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

var _noop = _interopRequireDefault(require("lodash/noop"));

var _classnames = _interopRequireDefault(require("classnames"));

var _button = _interopRequireDefault(require("../button"));

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

function TransferOperation(props) {
  var _props$moveToLeft = props.moveToLeft,
      moveToLeft = _props$moveToLeft === void 0 ? _noop["default"] : _props$moveToLeft,
      _props$moveToRight = props.moveToRight,
      moveToRight = _props$moveToRight === void 0 ? _noop["default"] : _props$moveToRight,
      _props$leftArrowText = props.leftArrowText,
      leftArrowText = _props$leftArrowText === void 0 ? '' : _props$leftArrowText,
      _props$rightArrowText = props.rightArrowText,
      rightArrowText = _props$rightArrowText === void 0 ? '' : _props$rightArrowText,
      leftActive = props.leftActive,
      rightActive = props.rightActive,
      className = props.className,
      multiple = props.multiple,
      oneWay = props.oneWay;
  var customLeftClass = (0, _classnames["default"])("".concat(className, "-custom-left-active"), (0, _defineProperty2["default"])({}, "".concat(className, "-custom-left-disable"), !leftActive));
  var customRightClass = (0, _classnames["default"])("".concat(className, "-custom-left-active"), (0, _defineProperty2["default"])({}, "".concat(className, "-custom-left-disable"), !rightActive));

  if (multiple) {
    var leftArrowBtn;
    var rightArrowBtn;

    if (typeof leftArrowText === 'string') {
      leftArrowBtn = /*#__PURE__*/_react["default"].createElement(_button["default"], {
        color: leftActive ? _enum.ButtonColor.primary : _enum.ButtonColor["default"],
        disabled: !leftActive,
        onClick: moveToLeft,
        icon: 'navigate_before'
      }, leftArrowText);
    } else {
      leftArrowBtn = /*#__PURE__*/_react["default"].createElement("div", {
        className: customLeftClass,
        onClick: leftActive ? moveToLeft : undefined
      }, leftArrowText);
    }

    if (typeof rightArrowText === 'string') {
      rightArrowBtn = /*#__PURE__*/_react["default"].createElement(_button["default"], {
        color: rightActive ? _enum.ButtonColor.primary : _enum.ButtonColor["default"],
        disabled: !rightActive,
        onClick: moveToRight,
        icon: 'navigate_next'
      }, rightArrowText);
    } else {
      rightArrowBtn = /*#__PURE__*/_react["default"].createElement("div", {
        className: customRightClass,
        onClick: rightActive ? moveToRight : undefined
      }, rightArrowText);
    }

    return /*#__PURE__*/_react["default"].createElement("div", {
      className: className
    }, oneWay ? null : leftArrowBtn, rightArrowBtn);
  }

  return null;
}
//# sourceMappingURL=TransferOperation.js.map
