"use strict";

exports.__esModule = true;
exports.default = void 0;
var _getOr2 = _interopRequireDefault(require("lodash/fp/getOr"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _bubbling = _interopRequireDefault(require("../../util/bubbling"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _button = _interopRequireDefault(require("../../atom/button"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const Popin = (props, context) => {
  const {
    skin
  } = context;
  const {
    ctaLabel,
    ctaOnClick,
    header,
    closeOnClick,
    content
  } = props;
  function createMarkup() {
    return {
      __html: content
    };
  }
  const primary = (0, _getOr2.default)('#00B0FF', ['common', 'primary'], skin);
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.defaultStyle,
    onClick: closeOnClick
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.popin,
    onClick: _bubbling.default
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.header,
    onClick: closeOnClick,
    "data-name": "popin-header"
  }, header), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.content
  }, /*#__PURE__*/_react.default.createElement("div", {
    // eslint-disable-next-line react/no-danger
    dangerouslySetInnerHTML: createMarkup()
  })), /*#__PURE__*/_react.default.createElement(_button.default, {
    type: "link",
    className: _style.default.button,
    onClick: ctaOnClick,
    submitValue: ctaLabel,
    centered: true,
    style: {
      backgroundColor: primary
    }
  })));
};
Popin.contextTypes = {
  skin: _provider.default.childContextTypes.skin
};
Popin.propTypes = process.env.NODE_ENV !== "production" ? {
  ctaLabel: _propTypes.default.string,
  ctaOnClick: _propTypes.default.func,
  closeOnClick: _propTypes.default.func,
  header: _propTypes.default.string,
  content: _propTypes.default.string
} : {};
var _default = exports.default = Popin;
//# sourceMappingURL=index.js.map