Passed
Push — master ( 9e8d48...ad4ce1 )
by Daniel
01:34 queued 10s
created

classShowHideElements   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 20
dl 0
loc 45
rs 10
c 0
b 0
f 0

5 Functions

Rating   Name   Duplication   Size   Complexity  
A hideDataTable 0 7 1
A hideLoadingSpinner 0 7 1
A hideElements 0 8 1
A showLoadingSpinner 0 6 1
A showDataTable 0 9 1
1
/**
2
 * Class that contains methods for hiding and showing elements when needed
3
 */
4
export default class classShowHideElements {
5
  /**
6
   * Show the loading spinner
7
   * @returns void
8
   */
9
  static showLoadingSpinner() {
10
    window.document.getElementById('loadingSpinner')!.classList.remove('hide');
11
  }
12
13
  /**
14
   * Hide the loading spinner
15
   * @returns void
16
   */
17
  static hideLoadingSpinner() {
18
    window.document.getElementById('loadingSpinner')!.classList.add('hide');
19
  }
20
21
  /**
22
   * Display the table and add animation class
23
   * @returns void
24
   */
25
  static showDataTable() {
26
    window.document
27
      .getElementById('tableElement')!
28
      .classList.remove('scale-out');
29
  }
30
31
  /**
32
   * Hide the table. Usually caused by an error
33
   * @returns void
34
   */
35
  static hideDataTable() {
36
    window.document.getElementById('tableElement')!.classList.add('scale-out');
37
  }
38
39
  /**
40
   * Hide loading spinner and data table
41
   * @returns void
42
   */
43
  static hideElements() {
44
    window.document.getElementById('tableElement')!.classList.add('scale-out');
45
    window.document.getElementById('loadingSpinner')!.classList.add('hide');
46
  }
47
}
48