/*
 * @Author: codingfly
 * @Description:
 * @Date: 2021-10-13 08:23:51
 * @LastEditTime: 2021-10-13 08:25:59
 * @FilePath: \ui_model\src\loading\index.tsx
 */
import React from 'react';
import { View } from 'remax/one';
import styles from './index.module.less';
import NeedWrap from '../need-wrap';
import Shadow from '../shadow';
import Icon from '../icon';
import { useConfig } from '../config-provider';
import Space from '../space';
export default (function (_ref) {
  var type = _ref.type,
      _ref$content = _ref.content,
      content = _ref$content === void 0 ? '加载中' : _ref$content;

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

  var top = type === 'top';

  if (type === 'inline') {
    return /*#__PURE__*/React.createElement(Space, {
      size: 10,
      className: styles.tip,
      alignItems: 'center',
      justify: 'center'
    }, /*#__PURE__*/React.createElement(Icon, {
      color: '#CCCCCC',
      name: 'loading2'
    }), content);
  }

  return /*#__PURE__*/React.createElement(View, {
    className: !top && styles.mask
  }, /*#__PURE__*/React.createElement(NeedWrap, {
    need: top,
    wrap: Shadow
  }, /*#__PURE__*/React.createElement(View, {
    className: top ? styles.top : styles.full
  }, /*#__PURE__*/React.createElement(Icon, {
    name: top ? 'loading' : 'loading2',
    color: top ? brandPrimary : '#fff',
    className: top ? styles.topIcon : styles.fullIcon
  }), !top && /*#__PURE__*/React.createElement(View, {
    className: styles.text
  }, content))));
});