import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import React from "react";
import { Row } from '@whalecloud/fdx';
import RenderElement from "../../../components/Element";
import styled from "styled-components";
var WrapContainer = /*#__PURE__*/styled("div", {
  target: "e1g56n9j0",
  label: "WrapContainer"
})({
  height: '100%',
  "> div": {
    height: '100%'
  }
});
var OuterDiv = /*#__PURE__*/React.memo( /*#__PURE__*/styled("div", {
  target: "e1g56n9j1",
  label: "OuterDiv"
})(function (_ref) {
  var previewDevice = _ref.previewDevice;
  var style = {};

  if (previewDevice === 'Mobile') {
    style = {
      backgroundColor: '#dbe5f0',
      padding: 20,
      textAlign: 'center',
      "> div": {
        width: 320,
        height: '100%',
        backgroundColor: '#fff',
        margin: '0 auto'
      }
    };
  } else if (previewDevice === 'Pad') {
    style = {
      backgroundColor: '#dbe5f0',
      padding: 20,
      textAlign: 'center',
      "> div": {
        width: 768,
        height: '100%',
        backgroundColor: '#fff',
        margin: '0 auto'
      }
    };
  }

  return style;
}));

var Document = function Document(_ref2) {
  var element = _ref2.element,
      previewDevice = _ref2.previewDevice,
      restProps = _objectWithoutProperties(_ref2, ["element", "previewDevice"]);

  if (!element || Array.isArray(element)) {
    return null;
  }

  var _element$data = element.data;
  _element$data = _element$data === void 0 ? {} : _element$data;
  var _element$data$classNa = _element$data.className,
      className = _element$data$classNa === void 0 ? '' : _element$data$classNa;
  return /*#__PURE__*/React.createElement(WrapContainer, null, /*#__PURE__*/React.createElement(OuterDiv, {
    previewDevice: previewDevice
  }, /*#__PURE__*/React.createElement("div", {
    className: "webiny-pb-page-document ".concat(className)
  }, /*#__PURE__*/React.createElement(Row, null, element.elements.map(function (element) {
    return /*#__PURE__*/React.createElement(RenderElement, Object.assign({
      key: element.id,
      element: element
    }, restProps));
  })))));
};

export default Document;
//# sourceMappingURL=Document.js.map