function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from 'react';
import classnames from 'classnames';
import { NovaCompositionCoorpacademyCheck as RightIcon, NovaSolidStatusClose as WrongIcon } from '@coorpacademy/nova-icons';
import Provider, { GetTranslateFromContext } from '../provider';
import style from './style.css';
import propTypes from './types';
const Content = (props, legacyContext) => {
  const {
    icon,
    current,
    value
  } = props;
  const translate = GetTranslateFromContext(legacyContext);
  let child;
  let contentAriaLabel;
  switch (icon) {
    case 'no-answer':
      child = value;
      contentAriaLabel = translate('review_header_step_item.not_answered_question', {
        current: current ? 'current ' : '',
        headerStepValue: value
      });
      break;
    case 'right':
      child = /*#__PURE__*/React.createElement(RightIcon, {
        className: classnames(style.rightIcon, current && style.currentRightIcon),
        role: "status",
        "aria-label": translate('review_header_step_item.correct_question', {
          current: current ? 'current ' : '',
          headerStepValue: value
        })
      });
      break;
    case 'wrong':
      child = /*#__PURE__*/React.createElement(WrongIcon, {
        className: classnames(style.wrongIcon, current && style.currentWrongIcon),
        role: "alert",
        "aria-label": translate('review_header_step_item.incorrect_question', {
          current: current ? 'current ' : '',
          headerStepValue: value
        })
      });
      break;
    case 'errors-number':
      child = value;
      contentAriaLabel = translate('bulk_import.errors_number', {
        bulkImportErrorsNumber: value
      });
      break;
    case 'valid':
      child = /*#__PURE__*/React.createElement(RightIcon, {
        className: classnames(style.validIcon),
        role: "status",
        "aria-label": translate('bulk_import.valid_scorm')
      });
      break;
    case 'invalid':
      child = /*#__PURE__*/React.createElement(WrongIcon, {
        className: classnames(style.invalidIcon),
        role: "alert",
        "aria-label": translate('bulk_import.invalid_scorm')
      });
      break;
    default:
      return null;
  }
  return /*#__PURE__*/React.createElement("span", _extends({}, icon === 'no-answer' || icon === 'errors-number' ? {
    'aria-label': contentAriaLabel,
    role: 'status'
  } : {}, {
    className: style.value
  }), child);
};
const StatusItem = props => {
  const {
    icon,
    current,
    selected
  } = props;
  return /*#__PURE__*/React.createElement("div", {
    className: classnames(style.defaultStyle, icon === 'right' && style.right, icon === 'wrong' && style.wrong, current && style.current, icon === 'valid' && style.valid, icon === 'invalid' && style.invalid, icon === 'errors-number' && style.errorsNumber, selected && style.selected),
    "data-name": "status-item"
  }, /*#__PURE__*/React.createElement(Content, props));
};
Content.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
Content.contextTypes = {
  skin: Provider.childContextTypes.skin,
  translate: Provider.childContextTypes.translate
};
StatusItem.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
export default StatusItem;
//# sourceMappingURL=index.js.map