import _get from "lodash/fp/get";
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 PropTypes from 'prop-types';
import classnames from 'classnames';
import { NovaCompositionNavigationArrowLeft as BackIcon } from '@coorpacademy/nova-icons';
import Link from '../../../../../atom/link';
import Provider from '../../../../../atom/provider';
import style from './learner.css';
const LearnerHeaderWrapper = props => {
  const {
    children,
    mode,
    onClick
  } = props;
  if (mode === 'scorm') return /*#__PURE__*/React.createElement("div", {
    className: style.contentWrapperScorm
  }, /*#__PURE__*/React.createElement("div", {
    className: style.backIcon
  }), children);
  return /*#__PURE__*/React.createElement(Link, {
    onClick: onClick,
    className: style.contentWrapper
  }, /*#__PURE__*/React.createElement(BackIcon, {
    className: style.backIcon
  }), children);
};
LearnerHeaderWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
  onClick: Link.propTypes.onClick,
  mode: PropTypes.string,
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
} : {};
const Content = ({
  onClick,
  title,
  details,
  mode
}, context) => {
  const {
    skin
  } = context;
  const primarySkinColor = _get('common.primary', skin);
  return /*#__PURE__*/React.createElement(LearnerHeaderWrapper, {
    mode: mode,
    onClick: onClick
  }, /*#__PURE__*/React.createElement("div", {
    className: style.content
  }, /*#__PURE__*/React.createElement("div", {
    className: style.contentDetails,
    style: {
      color: primarySkinColor
    }
  }, details), /*#__PURE__*/React.createElement("span", {
    "data-name": "contentTitle",
    className: classnames(style.contentTitle, style.innerHTML)
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: title
    }
  })));
};
Content.contextTypes = {
  skin: Provider.childContextTypes.skin
};
Content.propTypes = process.env.NODE_ENV !== "production" ? {
  onClick: Link.propTypes.onClick,
  title: PropTypes.string.isRequired,
  details: PropTypes.string,
  mode: PropTypes.string
} : {};
const Subcontent = ({
  title,
  details
}, context) => /*#__PURE__*/React.createElement("div", {
  className: style.subcontent
}, /*#__PURE__*/React.createElement("div", {
  className: style.subcontentDetails
}, details), /*#__PURE__*/React.createElement("div", {
  className: classnames(style.subcontentTitle, style.innerHTML)
  // eslint-disable-next-line react/no-danger
  ,
  dangerouslySetInnerHTML: {
    __html: title
  }
}));
Subcontent.propTypes = process.env.NODE_ENV !== "production" ? {
  title: PropTypes.string.isRequired,
  details: PropTypes.string
} : {};
const LearnerHeader = (props, context) => {
  const {
    content,
    subcontent,
    mode
  } = props;
  return /*#__PURE__*/React.createElement("div", {
    className: style.wrapper
  }, /*#__PURE__*/React.createElement(Content, _extends({}, content, {
    mode: mode
  })), /*#__PURE__*/React.createElement(Subcontent, subcontent));
};
LearnerHeader.propTypes = process.env.NODE_ENV !== "production" ? {
  content: PropTypes.shape(Content.propTypes).isRequired,
  subcontent: PropTypes.shape(Subcontent.propTypes).isRequired,
  mode: PropTypes.string
} : {};
export default LearnerHeader;
//# sourceMappingURL=learner.js.map