import _get from "lodash/fp/get";
import React from 'react';
import PropTypes from 'prop-types';
import Provider from '../../atom/provider';
import Link from '../../atom/link';
import Cta from '../../atom/cta';
import style from './style.css';
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.createElement(Cta, {
    submitValue: submitValue,
    onClick: onClick,
    light: light
  });
};
const CardWithButton = (props, context) => {
  const {
    lightButtonLabel,
    primaryButtonLabel,
    tagLabel,
    onLightButtonClick,
    onPrimaryButtonClick,
    backgroundImg,
    children
  } = props;
  const {
    skin
  } = context;
  const primaryColor = _get('common.primary', skin);
  const inlineStyle = {
    color: primaryColor
  };
  return /*#__PURE__*/React.createElement("div", {
    className: style.container
  }, /*#__PURE__*/React.createElement("div", {
    className: style.imageBox
  }, /*#__PURE__*/React.createElement("div", {
    className: style.filtre
  }, /*#__PURE__*/React.createElement("div", {
    className: `${style.image} ${style.zoom}`,
    style: backgroundImage(backgroundImg)
  }, /*#__PURE__*/React.createElement("div", {
    className: style.content
  }, tagLabel ? /*#__PURE__*/React.createElement("div", {
    className: style.levelContainer
  }, /*#__PURE__*/React.createElement("div", {
    className: style.level
  }, /*#__PURE__*/React.createElement("p", null, tagLabel))) : null, children ? /*#__PURE__*/React.createElement("div", {
    className: style.avatar
  }, children) : null)))), /*#__PURE__*/React.createElement("div", {
    className: style.buttons
  }, lightButtonLabel ? /*#__PURE__*/React.createElement("a", {
    className: style.lightButton,
    style: inlineStyle,
    onClick: onLightButtonClick
  }, lightButtonLabel) : null, /*#__PURE__*/React.createElement(Button, {
    submitValue: primaryButtonLabel,
    onClick: onPrimaryButtonClick
  })));
};
CardWithButton.contextTypes = {
  translate: Provider.childContextTypes.translate,
  skin: Provider.childContextTypes.skin
};
Button.propTypes = process.env.NODE_ENV !== "production" ? {
  onClick: Cta.propTypes.onClick,
  submitValue: Cta.propTypes.submitValue
} : {};
CardWithButton.propTypes = process.env.NODE_ENV !== "production" ? {
  lightButtonLabel: Button.propTypes.submitValue,
  primaryButtonLabel: Button.propTypes.submitValue.isRequired,
  tagLabel: Link.propTypes.children,
  onLightButtonClick: Button.propTypes.onClick,
  onPrimaryButtonClick: Button.propTypes.onClick.isRequired,
  backgroundImg: PropTypes.string.isRequired,
  children: PropTypes.node
} : {};
export default CardWithButton;
//# sourceMappingURL=index.js.map