@Component({
selector: 'my-loader',
- styleUrls: [ './loader.component.scss' ],
- templateUrl: './loader.component.html'
+ template: `<div *ngIf="loading" class="spinner-border" [ngStyle]="getStyle()" role="status"></div>`
})
export class LoaderComponent {
@Input() loading: boolean
+ @Input() size: 'sm' | 'xl'
+
+ private readonly sizes = {
+ sm: {
+ width: '1rem',
+ height: '1rem',
+ 'border-width': '.2em'
+ },
+ xl: {
+ width: '3rem',
+ height: '3rem'
+ }
+ }
+
+ getStyle () {
+ if (!this.size) return undefined
+
+ return this.sizes[this.size]
+ }
}