"use strict";

exports.__esModule = true;
exports.default = void 0;
var _keys2 = _interopRequireDefault(require("lodash/fp/keys"));
var _isObject2 = _interopRequireDefault(require("lodash/fp/isObject"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const viewStyle = {
  cover: _style.default.cover,
  contain: _style.default.contain
};
const PictureBackground = props => {
  const {
    src,
    view,
    style,
    alt = ''
  } = props;
  const mobile = src.mobile;
  const desktop = src.desktop;
  const bgStyle = viewStyle[view];
  const pictureView = (0, _isObject2.default)(src) ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.deviceView
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.mobileContainer
  }, /*#__PURE__*/_react.default.createElement("img", {
    className: (0, _classnames.default)(_style.default.picture, bgStyle),
    src: mobile,
    alt: alt
  })), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.desktopContainer
  }, /*#__PURE__*/_react.default.createElement("img", {
    className: (0, _classnames.default)(_style.default.picture, bgStyle),
    src: desktop,
    alt: alt
  }))) : /*#__PURE__*/_react.default.createElement("img", {
    className: (0, _classnames.default)(_style.default.defaultStyle, bgStyle),
    src: src,
    alt: alt
  });
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.wrapper,
    style: style
  }, pictureView);
};
PictureBackground.propTypes = process.env.NODE_ENV !== "production" ? {
  view: _propTypes.default.oneOf((0, _keys2.default)(viewStyle)),
  src: _propTypes.default.oneOfType([_propTypes.default.objectOf(_propTypes.default.string), _propTypes.default.string.isRequired]),
  style: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])),
  alt: _propTypes.default.string
} : {};
var _default = exports.default = PictureBackground;
//# sourceMappingURL=index.js.map