import _keys from "lodash/fp/keys";
import _isObject from "lodash/fp/isObject";
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import cssStyle from './style.css';
const viewStyle = {
  cover: cssStyle.cover,
  contain: cssStyle.contain
};
const PictureBackground = props => {
  const {
    src,
    view,
    style,
    alt = ''
  } = props;
  const mobile = src.mobile;
  const desktop = src.desktop;
  const bgStyle = viewStyle[view];
  const pictureView = _isObject(src) ? /*#__PURE__*/React.createElement("div", {
    className: cssStyle.deviceView
  }, /*#__PURE__*/React.createElement("div", {
    className: cssStyle.mobileContainer
  }, /*#__PURE__*/React.createElement("img", {
    className: classnames(cssStyle.picture, bgStyle),
    src: mobile,
    alt: alt
  })), /*#__PURE__*/React.createElement("div", {
    className: cssStyle.desktopContainer
  }, /*#__PURE__*/React.createElement("img", {
    className: classnames(cssStyle.picture, bgStyle),
    src: desktop,
    alt: alt
  }))) : /*#__PURE__*/React.createElement("img", {
    className: classnames(cssStyle.defaultStyle, bgStyle),
    src: src,
    alt: alt
  });
  return /*#__PURE__*/React.createElement("div", {
    className: cssStyle.wrapper,
    style: style
  }, pictureView);
};
PictureBackground.propTypes = process.env.NODE_ENV !== "production" ? {
  view: PropTypes.oneOf(_keys(viewStyle)),
  src: PropTypes.oneOfType([PropTypes.objectOf(PropTypes.string), PropTypes.string.isRequired]),
  style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
  alt: PropTypes.string
} : {};
export default PictureBackground;
//# sourceMappingURL=index.js.map