"use strict";

exports.__esModule = true;
exports.default = void 0;
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _keys2 = _interopRequireDefault(require("lodash/fp/keys"));
var _noop2 = _interopRequireDefault(require("lodash/fp/noop"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _provider = _interopRequireDefault(require("../../../atom/provider"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const ICON_TYPES = {
  resources: _novaIcons.NovaLineVideosVideoClip3,
  klf: _novaIcons.NovaLineLoginKey1,
  tips: _novaIcons.NovaSolidLightsLightbulb4
};
const themeStyle = {
  setup: _style.default.setupPart,
  default: null
};
const AccordionPart = (props, context) => {
  const {
    skin
  } = context;
  const {
    title,
    content,
    iconType,
    theme,
    onClick = _noop2.default,
    isOpen = false
  } = props;
  const TitleIcon = ICON_TYPES[iconType];
  const darkColor = (0, _get2.default)('common.dark', skin);
  const mediumColor = (0, _get2.default)('common.medium', skin);
  const openIconClassName = isOpen ? _style.default.openIconActivated : _style.default.openIcon;
  const closeIconClassName = !isOpen ? _style.default.closeIconActivated : _style.default.closeIcon;
  return /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "accordionPart",
    className: themeStyle[theme]
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: isOpen ? _style.default.openHeader : _style.default.closedHeader,
    "data-type": iconType,
    onClick: onClick
  }, /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "title",
    className: _style.default.title
  }, TitleIcon ? /*#__PURE__*/_react.default.createElement(TitleIcon, {
    className: _style.default.titleIcon
  }) : null, /*#__PURE__*/_react.default.createElement("h3", {
    className: _style.default.titleLabel
  }, title)), /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationMore, {
    className: closeIconClassName,
    style: {
      color: darkColor
    }
  }), /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationLess, {
    className: openIconClassName,
    style: {
      color: mediumColor
    }
  })), isOpen ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.container
  }, content) : null);
};
AccordionPart.contextTypes = {
  skin: _provider.default.childContextTypes.skin
};
AccordionPart.propTypes = process.env.NODE_ENV !== "production" ? {
  iconType: _propTypes.default.oneOf((0, _keys2.default)(ICON_TYPES)),
  title: _propTypes.default.string,
  content: _propTypes.default.node,
  onClick: _propTypes.default.func,
  isOpen: _propTypes.default.bool,
  theme: _propTypes.default.string
} : {};
var _default = exports.default = AccordionPart;
//# sourceMappingURL=index.js.map