import classNames from 'classnames';
import { t } from '../i18n';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const getHeading = (heading, headingLevel) => {
  const Heading = `h${headingLevel}` || `h3`;
  if (heading) {
    return /*#__PURE__*/_jsx(Heading, {
      className: "ds-c-review__heading",
      children: heading
    });
  }
};

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