import _get from "lodash/fp/get";
import _keys from "lodash/fp/keys";
import _noop from "lodash/fp/noop";
import React from 'react';
import PropTypes from 'prop-types';
import { NovaCompositionNavigationMore as MoreIcon, NovaLineLoginKey1 as KeyIcon, NovaLineVideosVideoClip3 as VideoIcon, NovaSolidLightsLightbulb4 as LightBulbIcon, NovaCompositionNavigationLess as LessIcon } from '@coorpacademy/nova-icons';
import Provider from '../../../atom/provider';
import style from './style.css';
const ICON_TYPES = {
  resources: VideoIcon,
  klf: KeyIcon,
  tips: LightBulbIcon
};
const themeStyle = {
  setup: style.setupPart,
  default: null
};
const AccordionPart = (props, context) => {
  const {
    skin
  } = context;
  const {
    title,
    content,
    iconType,
    theme,
    onClick = _noop,
    isOpen = false
  } = props;
  const TitleIcon = ICON_TYPES[iconType];
  const darkColor = _get('common.dark', skin);
  const mediumColor = _get('common.medium', skin);
  const openIconClassName = isOpen ? style.openIconActivated : style.openIcon;
  const closeIconClassName = !isOpen ? style.closeIconActivated : style.closeIcon;
  return /*#__PURE__*/React.createElement("div", {
    "data-name": "accordionPart",
    className: themeStyle[theme]
  }, /*#__PURE__*/React.createElement("div", {
    className: isOpen ? style.openHeader : style.closedHeader,
    "data-type": iconType,
    onClick: onClick
  }, /*#__PURE__*/React.createElement("div", {
    "data-name": "title",
    className: style.title
  }, TitleIcon ? /*#__PURE__*/React.createElement(TitleIcon, {
    className: style.titleIcon
  }) : null, /*#__PURE__*/React.createElement("h3", {
    className: style.titleLabel
  }, title)), /*#__PURE__*/React.createElement(MoreIcon, {
    className: closeIconClassName,
    style: {
      color: darkColor
    }
  }), /*#__PURE__*/React.createElement(LessIcon, {
    className: openIconClassName,
    style: {
      color: mediumColor
    }
  })), isOpen ? /*#__PURE__*/React.createElement("div", {
    className: style.container
  }, content) : null);
};
AccordionPart.contextTypes = {
  skin: Provider.childContextTypes.skin
};
AccordionPart.propTypes = process.env.NODE_ENV !== "production" ? {
  iconType: PropTypes.oneOf(_keys(ICON_TYPES)),
  title: PropTypes.string,
  content: PropTypes.node,
  onClick: PropTypes.func,
  isOpen: PropTypes.bool,
  theme: PropTypes.string
} : {};
export default AccordionPart;
//# sourceMappingURL=index.js.map