"use strict";

exports.__esModule = true;
exports.default = void 0;
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _react = _interopRequireDefault(require("react"));
var _cssColorFunction = require("css-color-function");
var _provider = _interopRequireWildcard(require("../../atom/provider"));
var _tag = _interopRequireDefault(require("../../atom/tag"));
var _buttonLink = _interopRequireDefault(require("../../atom/button-link"));
var _circularProgressBar = _interopRequireDefault(require("../../atom/circular-progress-bar"));
var _types = require("./types");
var _style = _interopRequireDefault(require("./style.css"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const LearningPriorityCard = (props, context) => {
  const {
    tagLabel,
    title,
    progression,
    onClick
  } = props;
  const translate = (0, _provider.GetTranslateFromContext)(context);
  const skin = (0, _provider.GetSkinFromContext)(context);
  const exploreLocale = translate('Explore');
  const primarySkinColor = (0, _get2.default)('common.primary', skin);
  const buttonExploreProps = {
    customStyle: {
      backgroundColor: (0, _cssColorFunction.convert)(`color(${primarySkinColor} a(0.07))`),
      color: primarySkinColor,
      transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'
    },
    hoverBackgroundColor: primarySkinColor,
    hoverColor: '#FFFFFF',
    onClick,
    'aria-label': `${title}, ${exploreLocale}`,
    label: exploreLocale,
    'data-name': 'learning-priority-explore-button',
    icon: {
      position: 'left',
      faIcon: {
        name: 'compass',
        backgroundColor: (0, _cssColorFunction.convert)(`color(${primarySkinColor} a(0.07))`),
        color: primarySkinColor,
        size: 16
      }
    }
  };
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.container,
    "aria-label": `learning priority card ${title}`,
    "data-name": `learning-priority-card-${title}`
  }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_tag.default, {
    label: tagLabel,
    size: 'S'
  })), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.title
  }, title), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.circularProgressBarContainer
  }, /*#__PURE__*/_react.default.createElement(_circularProgressBar.default, {
    size: 162,
    strokeWidth: 12,
    progression,
    label: translate('completed'),
    'aria-label': `${title} ${progression}%`,
    'data-name': `circular-progress-bar-${title}`
  })), /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "button-explore-wrapper"
  }, /*#__PURE__*/_react.default.createElement(_buttonLink.default, buttonExploreProps)));
};
LearningPriorityCard.propTypes = process.env.NODE_ENV !== "production" ? _types.propTypes : {};
LearningPriorityCard.contextTypes = {
  skin: _provider.default.childContextTypes.skin,
  translate: _provider.default.childContextTypes.translate
};
var _default = exports.default = LearningPriorityCard;
//# sourceMappingURL=index.js.map