1 |
61381
|
k.triantaf
|
import {Component, Input, OnInit} from "@angular/core";
|
2 |
|
|
|
3 |
|
|
@Component({
|
4 |
|
|
selector: 'loading',
|
5 |
|
|
template: `
|
6 |
|
|
<ng-template [ngIf]="full" [ngIfElse]="loading">
|
7 |
|
|
<div class="uk-position-relative" style="height: 100vh; width: 99vw;">
|
8 |
|
|
<div class="uk-position-center">
|
9 |
|
|
<ng-container [ngTemplateOutlet]="loading"></ng-container>
|
10 |
|
|
</div>
|
11 |
|
|
</div>
|
12 |
|
|
</ng-template>
|
13 |
|
|
<ng-template #loading>
|
14 |
|
|
<div class="uk-flex uk-flex-center" [class.uk-margin-small-top]="top_margin">
|
15 |
|
|
<div [ngStyle]="style">
|
16 |
|
|
<span class="uk-icon uk-spinner" [ngClass]="color">
|
17 |
|
|
<svg width="60" height="60" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg" data-svg="spinner"><circle
|
18 |
|
|
fill="none" stroke="#000" cx="15" cy="15" r="14" style="stroke-width: 2px;"></circle></svg>
|
19 |
|
|
</span>
|
20 |
|
|
</div>
|
21 |
|
|
</div>
|
22 |
|
|
</ng-template>`
|
23 |
|
|
})
|
24 |
|
|
export class LoadingComponent implements OnInit {
|
25 |
|
|
@Input() color: string = 'portal-color';
|
26 |
|
|
@Input() full: boolean = false;
|
27 |
|
|
@Input() top_margin: boolean = true;
|
28 |
|
|
@Input() size: "small" | "medium" | "large" = "large";
|
29 |
|
|
public style;
|
30 |
|
|
|
31 |
|
|
constructor() {
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
ngOnInit() {
|
35 |
|
|
let size = 1;
|
36 |
|
|
if (this.size === 'medium') {
|
37 |
|
|
size = 2;
|
38 |
|
|
} else if (this.size === "large") {
|
39 |
|
|
size = 3;
|
40 |
|
|
}
|
41 |
|
|
this.style = {
|
42 |
|
|
width: size * 20 + 'px',
|
43 |
|
|
height: size * 20 + 'px'
|
44 |
|
|
};
|
45 |
|
|
}
|
46 |
|
|
}
|