Newer
Older
import { CommonModule } from '@angular/common';
import { isNotEmpty } from '@alfa-client/tech-shared';
import { FileIconComponent } from '../icons/file-icon/file-icon.component';
import { SpinnerIconComponent } from '../icons/spinner-icon/spinner-icon.component';
imports: [CommonModule, SpinnerIconComponent, FileIconComponent],
class="relative flex w-full items-start gap-3 border-b border-b-grayborder bg-background-100 px-3 py-2 hover:bg-background-200"
[disabled]="isLoading"
[attr.aria-disabled]="isLoading"
*ngIf="fileType && !isLoading && !hasError"
[fileType]="fileType"
size="large"
/>
<ods-file-icon *ngIf="!isLoading && hasError" fileType="exclamation" size="large" />
<ods-spinner-icon *ngIf="isLoading && !hasError" size="large" />
<div class="flex grow flex-col items-start break-all text-start text-text">
<p *ngIf="!hasError && !isLoading && caption" class="text-sm">
<p *ngIf="hasError && errorCaption" class="text-sm text-error">
<p *ngIf="isLoading && loadingCaption" class="text-sm">
{{ loadingCaption }}
</p>
<p *ngIf="description && !hasError" class="text-xs text-text/65">
{{ description }}
</p>
<p *ngFor="let error of errors" class="text-xs text-text/65">
<ng-content select="[close]" *ngIf="!isLoading"></ng-content>
@Input() caption: string = '';
@Input() errorCaption: string = '';
@Input() fileType: string = '';
@Input() set errorMessages(errorMessages: string[]) {
this.hasError = isNotEmpty(errorMessages);
this.errors = errorMessages;
public errors: string[] = [];
public hasError: boolean = false;