"use strict";

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

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

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

var _CreateButton = _interopRequireDefault(require("./CreateButton"));

var _RelateButton = _interopRequireDefault(require("./RelateButton"));

var _ButtonBar = _interopRequireDefault(require("../../../styles/cspace-ui/ButtonBar.css"));

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

const propTypes = {
  isCreatable: _propTypes.default.bool,
  isRelatable: _propTypes.default.bool,
  onCreateButtonClick: _propTypes.default.func,
  onRelateButtonClick: _propTypes.default.func
};
const defaultProps = {
  isRelatable: true
};

function RelatedRecordButtonBar(props) {
  const {
    isCreatable,
    isRelatable,
    onCreateButtonClick,
    onRelateButtonClick
  } = props;

  if (!isRelatable) {
    return null;
  }

  const createButton = isCreatable ? /*#__PURE__*/_react.default.createElement(_CreateButton.default, {
    onClick: onCreateButtonClick
  }) : undefined;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _ButtonBar.default.common
  }, createButton, /*#__PURE__*/_react.default.createElement(_RelateButton.default, {
    onClick: onRelateButtonClick
  }));
}

RelatedRecordButtonBar.propTypes = propTypes;
RelatedRecordButtonBar.defaultProps = defaultProps;