forked from ant-design/ant-design-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.web.tsx
51 lines (49 loc) · 1.54 KB
/
index.web.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import * as React from 'react';
import classNames from 'classnames';
import ActivityIndicatorProps from './ActivityIndicatorPropTypes';
export default class ActivityIndicator extends React.Component<ActivityIndicatorProps, any> {
static defaultProps = {
prefixCls: 'am-activity-indicator',
animating: true,
size: 'small',
color: 'gray',
panelColor: 'rgba(34,34,34,0.6)',
toast: false,
};
render() {
const { prefixCls, className, animating, toast, size, color, text } = this.props;
const wrapClass = classNames({
[`${prefixCls}`]: true,
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
[className]: !!className,
[`${prefixCls}-toast`]: !!toast,
});
const spinnerClass = classNames({
[`${prefixCls}-spinner`]: true,
[`${prefixCls}-spinner-lg`]: !!toast || size === 'large',
[`${prefixCls}-spinner-white`]: !!toast || color === 'white',
});
if (animating) {
if (toast) {
return (
<div className={wrapClass}>
<div className={`${prefixCls}-content`}>
<span className={spinnerClass}></span>
{ text && (<span className={`${prefixCls}-toast`}>{text}</span>) }
</div>
</div>
);
} else {
return (
<div className={wrapClass}>
<span className={spinnerClass}></span>
{ text && (<span className={`${prefixCls}-tip`}>{text}</span>) }
</div>
);
}
} else {
return null;
}
}
}