2021-02-19 18:50:34 +01:00
|
|
|
import {Component, Input, OnInit} from "@angular/core";
|
2019-12-23 14:59:56 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'loading',
|
|
|
|
template: `
|
2020-10-30 12:33:00 +01:00
|
|
|
<ng-template [ngIf]="full" [ngIfElse]="loading">
|
2020-12-17 16:38:28 +01:00
|
|
|
<div class="uk-position-relative" style="height: 100vh; width: 99vw;">
|
2020-10-30 12:33:00 +01:00
|
|
|
<div class="uk-position-center">
|
|
|
|
<ng-container [ngTemplateOutlet]="loading"></ng-container>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</ng-template>
|
|
|
|
<ng-template #loading>
|
2021-02-19 18:55:44 +01:00
|
|
|
<div [class]="'uk-flex uk-flex-center '+(top_margin ? 'uk-margin-small-top' : '')">
|
|
|
|
<div [ngStyle]="style">
|
|
|
|
<span class="uk-icon uk-spinner" [ngClass]="color">
|
2020-11-05 00:09:55 +01:00
|
|
|
<svg width="60" height="60" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg" data-svg="spinner"><circle
|
|
|
|
fill="none" stroke="#000" cx="15" cy="15" r="14" style="stroke-width: 2px;"></circle></svg>
|
2021-02-19 18:55:44 +01:00
|
|
|
</span>
|
|
|
|
</div>
|
2020-10-30 12:33:00 +01:00
|
|
|
</div>
|
|
|
|
</ng-template>`
|
2019-12-23 14:59:56 +01:00
|
|
|
})
|
2021-02-19 18:55:44 +01:00
|
|
|
export class LoadingComponent implements OnInit {
|
2021-02-19 18:50:34 +01:00
|
|
|
@Input() color: string = 'portal-color';
|
2020-10-30 12:33:00 +01:00
|
|
|
@Input() full: boolean = false;
|
2021-02-10 10:05:37 +01:00
|
|
|
@Input() top_margin: boolean = true;
|
2021-02-19 18:50:34 +01:00
|
|
|
@Input() size: "small" | "medium" | "large" = "large";
|
|
|
|
public style;
|
2021-02-19 18:55:44 +01:00
|
|
|
|
2019-12-23 14:59:56 +01:00
|
|
|
constructor() {
|
|
|
|
}
|
2021-02-19 18:50:34 +01:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
let size = 1;
|
2021-02-19 18:55:44 +01:00
|
|
|
if (this.size === 'medium') {
|
2021-02-19 18:50:34 +01:00
|
|
|
size = 2;
|
2021-02-19 18:55:44 +01:00
|
|
|
} else if (this.size === "large") {
|
2021-02-19 18:50:34 +01:00
|
|
|
size = 3;
|
|
|
|
}
|
|
|
|
this.style = {
|
2021-02-19 18:55:44 +01:00
|
|
|
width: size * 20 + 'px',
|
|
|
|
height: size * 20 + 'px'
|
2021-02-19 18:50:34 +01:00
|
|
|
};
|
|
|
|
}
|
2019-12-23 14:59:56 +01:00
|
|
|
}
|