"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = AuthLayout;
exports.BackgroundContent = BackgroundContent;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _classnames = _interopRequireDefault(require("classnames"));

var _js = require("../../globals/js");

var _excluded = ["image", "backgroundContent", "children", "className"],
    _excluded2 = ["children"];
var prefix = _js.settings.prefix;

function AuthLayout(_ref) {
  var _classNames;

  var image = _ref.image,
      backgroundContent = _ref.backgroundContent,
      children = _ref.children,
      className = _ref.className,
      other = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var style = image ? {
    backgroundImage: "url(".concat(image, ")")
  } : {};
  var wrapperClasses = (0, _classnames.default)("".concat(prefix, "--auth-background-wrapper"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--auth-background-image"), image), (0, _defineProperty2.default)(_classNames, "".concat(className), className), _classNames));
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
    className: "".concat(prefix, "--auth-wrapper")
  }, other), /*#__PURE__*/_react.default.createElement("div", {
    className: wrapperClasses,
    style: style
  }, backgroundContent), /*#__PURE__*/_react.default.createElement("div", {
    className: "".concat(prefix, "--auth-content-wrapper")
  }, children));
}

AuthLayout.propTypes = {
  /**
   * The content usually consisting out of forms
   */
  children: _propTypes.default.node.isRequired,

  /**
   * The image is set as background on the left section when provided
   */
  image: _propTypes.default.node,

  /**
   * This usually consist of `<BackgroundContent/>` if you wish to provide content and background color instead of an image
   */
  backgroundContent: _propTypes.default.node,

  /**
   * The CSS class name to be placed on the wrapping element.
   */
  className: _propTypes.default.string
};

function BackgroundContent(_ref2) {
  var children = _ref2.children,
      other = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, other, {
    className: "".concat(prefix, "--auth-background-content")
  }), children);
}

BackgroundContent.propTypes = {
  /**
   * The content usually consisting out of `<BackgroundContent/>`
   */
  children: _propTypes.default.node.isRequired,

  /**
   * The CSS class name to be placed on the wrapping element.
   */
  className: _propTypes.default.string
};