import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import React from "react";
import { css } from "emotion";
import Element from "../../../components/Element";
import { ElementRoot } from "../../../components/ElementRoot";
import ElementAnimation from "../../../components/ElementAnimation";

var Block = function Block(_ref) {
  var element = _ref.element,
      restProps = _objectWithoutProperties(_ref, ["element"]);

  return /*#__PURE__*/React.createElement(ElementAnimation, null, /*#__PURE__*/React.createElement(ElementRoot, {
    element: element
  }, function (_ref2) {
    var elementStyle = _ref2.elementStyle,
        elementAttributes = _ref2.elementAttributes,
        customClasses = _ref2.customClasses,
        combineClassNames = _ref2.combineClassNames;

    var width = elementStyle.width,
        alignItems = elementStyle.alignItems,
        justifyContent = elementStyle.justifyContent,
        containerStyle = _objectWithoutProperties(elementStyle, ["width", "alignItems", "justifyContent"]);

    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("div", Object.assign({
      style: {
        width: "100%",
        display: "flex",
        justifyContent: "center"
      },
      className: "webiny-pb-layout-block-container " + /*#__PURE__*/css(containerStyle, "label:Block;")
    }, elementAttributes), /*#__PURE__*/React.createElement("div", {
      style: {
        width: width ? width : "100%",
        alignSelf: justifyContent,
        alignItems: alignItems
      },
      className: combineClassNames.apply(void 0, ["webiny-pb-layout-block webiny-pb-base-page-element-style flex"].concat(_toConsumableArray(customClasses), [className]))
    }, element.elements.map(function (element) {
      return /*#__PURE__*/React.createElement(Element, Object.assign({
        key: element.id,
        element: element
      }, restProps));
    })));
  }));
};

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