'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

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

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

var _SubrecordDetachButton = require('../../../styles/cspace-ui/SubrecordDetachButton.css');

var _SubrecordDetachButton2 = _interopRequireDefault(_SubrecordDetachButton);

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

var Button = _cspaceInput.components.Button;


var messages = (0, _reactIntl.defineMessages)({
  label: {
    'id': 'subrecordDetachButton.label',
    'defaultMessage': 'Remove'
  }
});

var propTypes = {
  label: _propTypes2.default.node,
  onClick: _propTypes2.default.func
};

var defaultProps = {
  label: _react2.default.createElement(_reactIntl.FormattedMessage, messages.label)
};

function SubrecordDetachButton(props) {
  var label = props.label,
      onClick = props.onClick;


  return _react2.default.createElement(
    Button,
    {
      className: _SubrecordDetachButton2.default.common,
      icon: true,
      name: 'detachSubrecord',
      onClick: onClick
    },
    label
  );
}

SubrecordDetachButton.propTypes = propTypes;
SubrecordDetachButton.defaultProps = defaultProps;