Files
mina-sidor-fa-web/libs/ui/loader/loader.component.ts
Erik Tiekstra b2ff020edf feat(ui): Added loader inside ui-lib. (TV-859)
Squashed commit of the following:

commit 21101f1de202e87c27ae7832669e484d163e66b4
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Thu Oct 28 11:01:09 2021 +0200

    Updated imports

commit 0d8bee6ac8967f5ddb480eff429e91db812b0f16
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Thu Oct 28 10:42:35 2021 +0200

    Now using loader from inside libs
2021-10-28 11:38:45 +02:00

28 lines
869 B
TypeScript

import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { UiLoaderType } from './loader-type.enum';
@Component({
selector: 'ui-loader',
templateUrl: './loader.component.html',
styleUrls: ['./loader.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LoaderComponent {
private readonly _defaultClass = 'ui-loader';
@Input() uiType: UiLoaderType = UiLoaderType.PADDED;
@Input() uiSize: 's' | 'm' = 'm';
@Input() uiShowLoadingText = false;
@Input() uiLoadingText = 'Laddar innehåll';
get loaderClass(): string {
if (this.uiType) {
return `${this._defaultClass} ${this._defaultClass}--${this.uiType as string}`;
}
return this._defaultClass;
}
get spinnerClass(): string {
return `${this._defaultClass}__spinner ${this._defaultClass}__spinner--${this.uiSize}`;
}
}