10 changed files with 107 additions and 18 deletions
@ -0,0 +1,2 @@ |
|||
|
|||
<div class="spinner" *ngIf="show"></div> |
@ -0,0 +1,19 @@ |
|||
@import "../../assets/scss/variables"; |
|||
|
|||
.spinner { |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
height: 100vh; |
|||
width: 100vw; |
|||
background: $black-alpha; |
|||
background-image: url('/assets/images/loader.svg'); |
|||
background-size: 200px 200px; |
|||
background-repeat: no-repeat; |
|||
background-position: center center; |
|||
z-index: 100; |
|||
|
|||
&.active { |
|||
display: block; |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core' |
|||
|
|||
@Component({ |
|||
selector: 'app-spinner', |
|||
templateUrl: './spinner.component.html', |
|||
styleUrls: ['./spinner.component.scss'] |
|||
}) |
|||
|
|||
export class SpinnerComponent implements OnInit { |
|||
|
|||
@ViewChild('spinner') spinner: ElementRef |
|||
@Input() show: boolean = false |
|||
|
|||
ngOnInit(): void { |
|||
} |
|||
/* |
|||
loader(action) { |
|||
let op = 0 |
|||
let timer = null |
|||
|
|||
switch(action) { |
|||
case 'show': |
|||
op = 1 |
|||
timer = setInterval(() => { |
|||
if(op <= 0.1){ |
|||
clearInterval(timer) |
|||
this.spinner.nativeElement.style.display = 'none' |
|||
} |
|||
this.spinner.nativeElement.style.opacity = op |
|||
this.spinner.nativeElement.style.filter = 'alpha(opacity=' + op * 100 + ")" |
|||
op -= op * 0.1 |
|||
}, 50) |
|||
|
|||
break |
|||
case 'hide': |
|||
op = 0.1 |
|||
this.spinner.nativeElement.style.display = 'block' |
|||
timer = setInterval(() => { |
|||
if(op >= 1){ |
|||
clearInterval(timer) |
|||
} |
|||
this.spinner.nativeElement.style.opacity = op |
|||
this.spinner.nativeElement.style.filter = 'alpha(opacity=' + op * 100 + ")" |
|||
op += op * 0.1 |
|||
}, 50) |
|||
|
|||
break |
|||
} |
|||
}*/ |
|||
} |
Loading…
Reference in new issue