function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/*
 * @Author: codingfly
 * @Description:
 * @Date: 2021-08-11 13:45:29
 * @LastEditTime: 2021-09-08 14:20:16
 * @FilePath: \annar-master\components\loading\index.tsx
 */
import * as React from 'react';
import { View } from 'remax/one';
import classNames from 'classnames';
import { addUnit } from './../_utils';
import { getPrefixCls } from './../common';
var prefixCls = getPrefixCls('loading');

var Loading = function Loading(props) {
  var style = props.style,
      vertical = props.vertical,
      type = props.type,
      _props$color = props.color,
      color = _props$color === void 0 ? '#999' : _props$color,
      _props$gapColor = props.gapColor,
      gapColor = _props$gapColor === void 0 ? '#FDFFFD' : _props$gapColor,
      _props$size = props.size,
      size = _props$size === void 0 ? '28px' : _props$size,
      className = props.className;
  var new_style = Object.assign(Object.assign({}, style), {
    fontSize: addUnit(size)
  });

  var renderText = function renderText() {
    var text = props.text,
        _props$textSize = props.textSize,
        textSize = _props$textSize === void 0 ? "28px" : _props$textSize,
        textColor = props.textColor;

    if (text) {
      return /*#__PURE__*/React.createElement(View, {
        className: "".concat(prefixCls, "-text"),
        style: {
          fontSize: textSize,
          color: textColor || color
        }
      }, text);
    }
  };

  if (type === 'gap') {
    return /*#__PURE__*/React.createElement(View, {
      className: classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-vertical "), vertical))
    }, /*#__PURE__*/React.createElement(View, {
      className: "".concat(prefixCls, "-gap"),
      style: Object.assign(Object.assign({}, new_style), {
        border: "1Px solid ".concat(color)
      })
    }, /*#__PURE__*/React.createElement(View, {
      className: "".concat(prefixCls, "-gap-fill"),
      style: {
        backgroundColor: gapColor
      }
    })), renderText());
  }

  if (type === 'wave') {
    return /*#__PURE__*/React.createElement(View, {
      className: classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-vertical "), vertical))
    }, /*#__PURE__*/React.createElement(View, {
      className: "".concat(prefixCls, "-wave")
    }, /*#__PURE__*/React.createElement(View, {
      style: {
        backgroundColor: color
      }
    }), /*#__PURE__*/React.createElement(View, {
      style: {
        backgroundColor: color
      }
    }), /*#__PURE__*/React.createElement(View, {
      style: {
        backgroundColor: color
      }
    }), /*#__PURE__*/React.createElement(View, {
      style: {
        backgroundColor: color
      }
    }), /*#__PURE__*/React.createElement(View, {
      style: {
        backgroundColor: color
      }
    })), renderText());
  }

  return /*#__PURE__*/React.createElement(View, {
    className: classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-vertical "), vertical))
  }, /*#__PURE__*/React.createElement(View, {
    className: "".concat(prefixCls, "-content"),
    style: Object.assign(Object.assign({}, new_style), {
      borderColor: "".concat(color, " ").concat(color, " transparent")
    })
  }), renderText());
};

export default Loading;