]>
Commit | Line | Data |
---|---|---|
df98563e | 1 | import { Component, Input } from '@angular/core' |
157cb9c9 C |
2 | |
3 | @Component({ | |
4 | selector: 'my-loader', | |
a14c1764 | 5 | template: `<div *ngIf="loading" class="spinner-border" [ngStyle]="getStyle()" role="status"></div>` |
157cb9c9 | 6 | }) |
157cb9c9 | 7 | export class LoaderComponent { |
df98563e | 8 | @Input() loading: boolean |
a14c1764 C |
9 | @Input() size: 'sm' | 'xl' |
10 | ||
11 | private readonly sizes = { | |
12 | sm: { | |
13 | width: '1rem', | |
14 | height: '1rem', | |
93c728a2 | 15 | 'border-width': '0.15rem' |
a14c1764 C |
16 | }, |
17 | xl: { | |
18 | width: '3rem', | |
19 | height: '3rem' | |
20 | } | |
21 | } | |
22 | ||
23 | getStyle () { | |
24 | if (!this.size) return undefined | |
25 | ||
26 | return this.sizes[this.size] | |
27 | } | |
157cb9c9 | 28 | } |