"use strict";

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

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

var _one = require("remax/one");

var _indexModule = _interopRequireDefault(require("./index.module.less"));

var _needWrap = _interopRequireDefault(require("../need-wrap"));

var _shadow = _interopRequireDefault(require("../shadow"));

var _icon = _interopRequireDefault(require("../icon"));

var _configProvider = require("../config-provider");

var _space = _interopRequireDefault(require("../space"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/*
 * @Author: codingfly
 * @Description:
 * @Date: 2021-10-13 08:23:51
 * @LastEditTime: 2021-10-13 08:25:59
 * @FilePath: \ui_model\src\loading\index.tsx
 */
var _default = function _default(_ref) {
  var type = _ref.type,
      _ref$content = _ref.content,
      content = _ref$content === void 0 ? '加载中' : _ref$content;

  var _useConfig = (0, _configProvider.useConfig)(),
      brandPrimary = _useConfig.brandPrimary;

  var top = type === 'top';

  if (type === 'inline') {
    return /*#__PURE__*/_react.default.createElement(_space.default, {
      size: 10,
      className: _indexModule.default.tip,
      alignItems: 'center',
      justify: 'center'
    }, /*#__PURE__*/_react.default.createElement(_icon.default, {
      color: '#CCCCCC',
      name: 'loading2'
    }), content);
  }

  return /*#__PURE__*/_react.default.createElement(_one.View, {
    className: !top && _indexModule.default.mask
  }, /*#__PURE__*/_react.default.createElement(_needWrap.default, {
    need: top,
    wrap: _shadow.default
  }, /*#__PURE__*/_react.default.createElement(_one.View, {
    className: top ? _indexModule.default.top : _indexModule.default.full
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
    name: top ? 'loading' : 'loading2',
    color: top ? brandPrimary : '#fff',
    className: top ? _indexModule.default.topIcon : _indexModule.default.fullIcon
  }), !top && /*#__PURE__*/_react.default.createElement(_one.View, {
    className: _indexModule.default.text
  }, content))));
};

exports.default = _default;