Blame view

src/Spin/Spin.js 606 Bytes
3a3ecabe   Imshann   init
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
  import template from "./Spin.html";
  
  class Spin {
      props = {
          size: String,
          spinning: Boolean
      };
  
      state = {
          className: [],
          hasChildren: false,
      };
  
      template = template;
  
      constructor() {
          this.state.className = ["ant-spin", "ant-spin-spinning"];
          this.state.hasChildren = JSON.stringify($transclude()) !== "{}";
  
          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");
          }
      }
  }