import React from 'react';
import PropTypes from 'prop-types';
import getOr from 'lodash/fp/getOr';
import map from 'lodash/fp/map';
import { NovaSolidStatusCheckCircle2 as CheckIcon, NovaSolidVoteRewardsVoteHeart as HeartIcon, NovaSolidInterfaceFeedbackInterfaceQuestionMark as QuestionIcon, NovaLineSelectionCursorsCursorArrowTarget as TargetIcon } from '@coorpacademy/nova-icons';
import ToolTip from '../tooltip';
import style from './style.css';
import propTypes from './prop-types';
const ICONS = {
  skills: TargetIcon,
  questions: QuestionIcon,
  lifes: HeartIcon,
  allright: CheckIcon
};
const ReviewIcon = ({
  icon
}) => {
  const Icon = getOr(null, icon, ICONS);

  /* istanbul ignore next */
  if (!Icon) {
    return /*#__PURE__*/React.createElement("div", {
      className: style.labelIcon
    });
  }
  return /*#__PURE__*/React.createElement(Icon, {
    className: style.labelIcon
  });
};
const ReviewListItemWrapper = ({
  iconKey,
  label
}) => {
  return /*#__PURE__*/React.createElement("div", {
    className: style.reviewListItemWrapper,
    "data-tip": true,
    "data-for": "reviewListItem",
    tabIndex: 0
  }, /*#__PURE__*/React.createElement("div", {
    className: style.reviewListText
  }, /*#__PURE__*/React.createElement(ReviewIcon, {
    icon: iconKey
  }), " ", label.text), /*#__PURE__*/React.createElement(ToolTip, {
    TooltipContent: label.tooltipText,
    closeToolTipInformationTextAriaLabel: label.closeToolTipInformationTextAriaLabel,
    "data-testid": `review-list-item-tooltip-button-${iconKey}`,
    "aria-label": label.moreDetailsAriaLabel
  }));
};
const ReviewPresentation = props => {
  const {
    'aria-label': ariaLabel,
    reviewTitle,
    reviewText,
    labelsList
  } = props;
  return /*#__PURE__*/React.createElement("div", {
    className: style.reviewWrapper,
    "aria-label": ariaLabel
  }, /*#__PURE__*/React.createElement("div", {
    className: style.reviewTitle
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: reviewTitle
    }
  }), /*#__PURE__*/React.createElement("div", {
    className: style.reviewText
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: reviewText
    }
  }), /*#__PURE__*/React.createElement("ul", {
    className: style.reviewListWrapper
  }, map.convert({
    cap: false
  })((label, key) => {
    return /*#__PURE__*/React.createElement("li", {
      key: `step-${key}`,
      className: style.reviewList
    }, /*#__PURE__*/React.createElement(ReviewListItemWrapper, {
      iconKey: key,
      label: label,
      tooltipText: label.tooltipText,
      "aria-label": label.moreDetailsAriaLabel
    }));
  }, labelsList)));
};
ReviewIcon.propTypes = process.env.NODE_ENV !== "production" ? {
  icon: PropTypes.string
} : {};
ReviewListItemWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
  iconKey: PropTypes.string,
  label: PropTypes.shape({
    tooltipText: ToolTip.propTypes.tooltipText,
    moreDetailsAriaLabel: ToolTip.propTypes['aria-label'],
    closeToolTipInformationTextAriaLabel: ToolTip.propTypes.closeToolTipInformationTextAriaLabel,
    text: PropTypes.string
  })
} : {};
ReviewPresentation.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
export default ReviewPresentation;
//# sourceMappingURL=index.js.map