import React from 'react';
import classNames from 'classnames';
import { t } from '../i18n';
var getHeading = function getHeading(heading, headingLevel) {
  var Heading = "h".concat(headingLevel) || "h3";
  if (heading) {
    return /*#__PURE__*/React.createElement(Heading, {
      className: "ds-c-review__heading"
    }, heading);
  }
};

/**
 * For information about how and when to use this component,
 * [refer to its full documentation page](https://design.cms.gov/components/review/).
 */
export var Review = function Review(props) {
  var _props$editText;
  var handleClick = function handleClick(event) {
    if (props.onEditClick) {
      props.onEditClick(event, props.editHref);
    }
  };
  var classes = classNames('ds-c-review', props.className);
  return /*#__PURE__*/React.createElement("div", {
    className: classes
  }, /*#__PURE__*/React.createElement("div", {
    className: "ds-c-review__content"
  }, getHeading(props.heading, props.headingLevel), /*#__PURE__*/React.createElement("div", {
    className: "ds-c-review__body"
  }, props.children)), props.editContent, !props.editContent && props.editHref && /*#__PURE__*/React.createElement("a", {
    onClick: handleClick,
    href: props.editHref,
    "aria-label": props.editAriaLabel
  }, (_props$editText = props.editText) !== null && _props$editText !== void 0 ? _props$editText : t('review.editText')));
};
Review.defaultProps = {
  headingLevel: '3'
};
export default Review;