import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Spinner } from './Spinner/Spinner';
export var Loader =
/*#__PURE__*/
function (_PureComponent) {
  _inheritsLoose(Loader, _PureComponent);

  function Loader() {
    return _PureComponent.apply(this, arguments) || this;
  }

  var _proto = Loader.prototype;

  _proto.renderContent = function renderContent() {
    var children = this.props.children;

    if (!children || typeof children === 'string' && !children.trim()) {
      return null;
    }

    return React.createElement("div", {
      className: "loader-content"
    }, children);
  };

  _proto.render = function render() {
    var size = this.props.size;
    return React.createElement("div", {
      className: "loader-overlay"
    }, React.createElement("div", {
      className: "loader-wrapper"
    }, React.createElement("div", {
      className: "loader"
    }, React.createElement(Spinner, {
      size: size
    }), this.renderContent())));
  };

  return Loader;
}(PureComponent);

_defineProperty(Loader, "propTypes", {
  children: PropTypes.node,
  size: PropTypes.number
});

_defineProperty(Loader, "defaultProps", {
  children: null,
  size: 32
});