UNPKG

@gdjiami/jm-mrc-components

Version:

移动端可复用组件库

46 lines (45 loc) 2.4 kB
import { __makeTemplateObject } from "tslib"; import classnames from 'classnames'; import React from 'react'; import styled from 'styled-components'; import Loading from './Loading'; import './style/index.css'; var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) { return props.panelColor; }); var ActivityIndicator = function (props) { var _a, _b; var prefixCls = props.prefixCls, className = props.className, visible = props.visible, toast = props.toast, size = props.size, text = props.text, panelColor = props.panelColor; var wrapClass = classnames(prefixCls, className, (_a = {}, _a[prefixCls + "-lg"] = size === 'large', _a[prefixCls + "-sm"] = size === 'small', _a[prefixCls + "-toast"] = !!toast, _a)); var spinnerClass = classnames(prefixCls + "-spinner", (_b = {}, _b[prefixCls + "-spinner-lg"] = !!toast || size === 'large', _b)); if (visible) { if (toast) { return (React.createElement("div", { className: wrapClass }, text ? (React.createElement(Content, { className: prefixCls + "-content", panelColor: panelColor }, React.createElement(Loading, { className: spinnerClass, "aria-hidden": "true" }), React.createElement("span", { className: prefixCls + "-toast-text" }, text))) : (React.createElement(Content, { className: prefixCls + "-content", panelColor: panelColor }, React.createElement(Loading, { className: spinnerClass, "aria-label": "Loading" }))))); } else { return text ? (React.createElement("div", { className: wrapClass }, React.createElement(Loading, { className: spinnerClass, "aria-hidden": "true" }), React.createElement("span", { className: prefixCls + "-tip" }, text))) : (React.createElement("div", { className: wrapClass }, React.createElement(Loading, { className: spinnerClass, "aria-label": "Loading" }))); } } else { return null; } }; ActivityIndicator.defaultProps = { prefixCls: 'jm-activity-indicator', visible: true, size: 'small', panelColor: 'rgba(34,34,34,0.6)', toast: false, }; export default ActivityIndicator; var templateObject_1;