"use strict";

exports.__esModule = true;
exports.default = void 0;
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _link = _interopRequireDefault(require("../../atom/link"));
var _cta = _interopRequireDefault(require("../../atom/cta"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function backgroundImage(url) {
  return {
    background: `linear-gradient(
      rgba(0, 0, 0, 0.65), 
      rgba(0, 0, 0, 0.65)
      ),url(${url})`,
    backgroundSize: 'cover'
  };
}
const Button = props => {
  const {
    onClick,
    submitValue,
    light = false
  } = props;
  return /*#__PURE__*/_react.default.createElement(_cta.default, {
    submitValue: submitValue,
    onClick: onClick,
    light: light
  });
};
const CardWithButton = (props, context) => {
  const {
    lightButtonLabel,
    primaryButtonLabel,
    tagLabel,
    onLightButtonClick,
    onPrimaryButtonClick,
    backgroundImg,
    children
  } = props;
  const {
    skin
  } = context;
  const primaryColor = (0, _get2.default)('common.primary', skin);
  const inlineStyle = {
    color: primaryColor
  };
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.container
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.imageBox
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.filtre
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: `${_style.default.image} ${_style.default.zoom}`,
    style: backgroundImage(backgroundImg)
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.content
  }, tagLabel ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.levelContainer
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.level
  }, /*#__PURE__*/_react.default.createElement("p", null, tagLabel))) : null, children ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.avatar
  }, children) : null)))), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.buttons
  }, lightButtonLabel ? /*#__PURE__*/_react.default.createElement("a", {
    className: _style.default.lightButton,
    style: inlineStyle,
    onClick: onLightButtonClick
  }, lightButtonLabel) : null, /*#__PURE__*/_react.default.createElement(Button, {
    submitValue: primaryButtonLabel,
    onClick: onPrimaryButtonClick
  })));
};
CardWithButton.contextTypes = {
  translate: _provider.default.childContextTypes.translate,
  skin: _provider.default.childContextTypes.skin
};
Button.propTypes = process.env.NODE_ENV !== "production" ? {
  onClick: _cta.default.propTypes.onClick,
  submitValue: _cta.default.propTypes.submitValue
} : {};
CardWithButton.propTypes = process.env.NODE_ENV !== "production" ? {
  lightButtonLabel: Button.propTypes.submitValue,
  primaryButtonLabel: Button.propTypes.submitValue.isRequired,
  tagLabel: _link.default.propTypes.children,
  onLightButtonClick: Button.propTypes.onClick,
  onPrimaryButtonClick: Button.propTypes.onClick.isRequired,
  backgroundImg: _propTypes.default.string.isRequired,
  children: _propTypes.default.node
} : {};
var _default = exports.default = CardWithButton;
//# sourceMappingURL=index.js.map