mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:21:31 +00:00
Add CPU eating loader waiting for configuration to finish
This commit is contained in:
parent
4ac350d665
commit
65c7c727f5
7
src/app/loader/loader.component.html
Normal file
7
src/app/loader/loader.component.html
Normal file
@ -0,0 +1,7 @@
|
||||
<div *ngIf="loading" class="loading-container">
|
||||
<div class=" loader">
|
||||
<div class="outer"></div>
|
||||
<div class="middle"></div>
|
||||
<div class="inner"></div>
|
||||
</div>
|
||||
</div>
|
62
src/app/loader/loader.component.scss
Normal file
62
src/app/loader/loader.component.scss
Normal file
@ -0,0 +1,62 @@
|
||||
.loading-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
z-index: 99999;
|
||||
filter: blur(0px)!important;
|
||||
}
|
||||
|
||||
.loader {
|
||||
position: relative;
|
||||
filter: blur(0px) !important;
|
||||
}
|
||||
|
||||
.outer,
|
||||
.middle,
|
||||
.inner {
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #277EEC;
|
||||
border-right-color: #277EEC;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
.outer {
|
||||
width: 3.5em;
|
||||
height: 3.5em;
|
||||
margin-left: -1.75em;
|
||||
margin-top: -1.75em;
|
||||
animation: spin 2s linear infinite;
|
||||
}
|
||||
|
||||
.middle {
|
||||
width: 2.1em;
|
||||
height: 2.1em;
|
||||
margin-left: -1.05em;
|
||||
margin-top: -1.05em;
|
||||
animation: spin 1.75s linear reverse infinite;
|
||||
}
|
||||
|
||||
.inner {
|
||||
width: 0.8em;
|
||||
height: 0.8em;
|
||||
margin-left: -0.4em;
|
||||
margin-top: -0.4em;
|
||||
animation: spin 1.5s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
29
src/app/loader/loader.component.ts
Normal file
29
src/app/loader/loader.component.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { Component, Input, AfterViewInit, OnInit } from '@angular/core';
|
||||
import { ConfigReadyService } from '../services/config.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-loader',
|
||||
templateUrl: './loader.component.html',
|
||||
styleUrls: ['./loader.component.scss']
|
||||
})
|
||||
export class LoaderComponent implements OnInit, AfterViewInit {
|
||||
@Input() toBlur: HTMLElement;
|
||||
loading = true;
|
||||
|
||||
constructor(private configReadyService: ConfigReadyService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.configReadyService.init();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.toBlur.classList.add('blur');
|
||||
this.configReadyService.configDone.subscribe(
|
||||
() => {
|
||||
this.loading = false;
|
||||
this.toBlur.classList.remove('blur');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user