"use strict";

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

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

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

var _reactIntl = require("react-intl");

var _cspaceInput = require("cspace-input");

var _UndeprecateButton = _interopRequireDefault(require("../../../styles/cspace-ui/UndeprecateButton.css"));

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

const {
  Button
} = _cspaceInput.components;
const messages = (0, _reactIntl.defineMessages)({
  label: {
    "id": "undeprecateButton.label",
    "defaultMessage": "Activate"
  }
});
const propTypes = {
  isUndeprecatable: _propTypes.default.bool,
  isModified: _propTypes.default.bool,
  isSavePending: _propTypes.default.bool,
  onClick: _propTypes.default.func
};

function UndeprecateButton(props) {
  const {
    isUndeprecatable,
    isModified,
    isSavePending,
    onClick
  } = props;

  if (!isUndeprecatable) {
    return null;
  }

  return _react.default.createElement(Button, {
    className: _UndeprecateButton.default.common,
    disabled: isModified || isSavePending,
    icon: true,
    name: "undeprecate",
    onClick: onClick
  }, _react.default.createElement(_reactIntl.FormattedMessage, messages.label));
}

UndeprecateButton.propTypes = propTypes;