"use strict";

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

var _reactRedux = require("react-redux");

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _index = require("../../actions/index.js");

require("./Toolbar.css");

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

function UnconnectedToolbar(props) {
  var dispatch = props.dispatch,
      history = props.history;

  var undoLink = /*#__PURE__*/_react["default"].createElement("span", {
    key: "undoLink",
    className: "_dash-undo-redo-link",
    onClick: function onClick() {
      return dispatch(_index.undo);
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "_dash-icon-undo"
  }, "\u21BA"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "_dash-undo-redo-label"
  }, "undo"));

  var redoLink = /*#__PURE__*/_react["default"].createElement("span", {
    key: "redoLink",
    className: "_dash-undo-redo-link",
    onClick: function onClick() {
      return dispatch(_index.redo);
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "_dash-icon-redo"
  }, "\u21BB"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "_dash-undo-redo-label"
  }, "redo"));

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "_dash-undo-redo"
  }, /*#__PURE__*/_react["default"].createElement("div", null, history.past.length > 0 ? undoLink : null, history.future.length > 0 ? redoLink : null));
}

UnconnectedToolbar.propTypes = {
  history: _propTypes["default"].object,
  dispatch: _propTypes["default"].func
};
var Toolbar = (0, _reactRedux.connect)(function (state) {
  return {
    history: state.history
  };
}, function (dispatch) {
  return {
    dispatch: dispatch
  };
})(UnconnectedToolbar);
var _default = Toolbar;
exports["default"] = _default;