Spin.js
783 Bytes
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
import template from "./Spin.html";
class Spin {
state = {
className: [],
hasChildren: false,
};
constructor($element, $attrs, $controllers, $transclude) {
this.state.className = ["ant-spin", "ant-spin-spinning"];
if ($transclude()) {
let len = $transclude().lenght;
if (len > 0) {
this.state.hasChildren = true;
}
}
if (this.size === "small") {
this.state.className.splice(1, 0, "ant-spin-sm");
}
if (this.size === "large") {
this.state.className.splice(1, 0, "ant-spin-lg");
}
}
render() {
return template;
}
}
Spin.propTypes = {
size: PropTypes.string,
spinning: PropTypes.boolean,
}