"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = DeprecateButton;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _reactIntl = require("react-intl");
var _cspaceInput = require("cspace-input");
var _DeprecateButton = _interopRequireDefault(require("../../../styles/cspace-ui/DeprecateButton.css"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const {
  Button
} = _cspaceInput.components;
const messages = (0, _reactIntl.defineMessages)({
  label: {
    "id": "deprecateButton.label",
    "defaultMessage": "Deactivate"
  }
});
const propTypes = {
  isDeprecatable: _propTypes.default.bool,
  isModified: _propTypes.default.bool,
  isSavePending: _propTypes.default.bool,
  onClick: _propTypes.default.func
};
function DeprecateButton(props) {
  const {
    isDeprecatable,
    isModified,
    isSavePending,
    onClick
  } = props;
  if (!isDeprecatable) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(Button, {
    className: _DeprecateButton.default.common,
    disabled: isModified || isSavePending,
    icon: true,
    name: "deprecate",
    onClick: onClick
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, messages.label));
}
DeprecateButton.propTypes = propTypes;