From 7601b2f4ab0f8c20cf3d72eef7ad3a9c9e51b2b9 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Wed, 22 May 2024 11:29:18 +0200
Subject: [PATCH] OZG-5698-OZG-5765 Add errorCaption to attachment

---
 .../src/lib/attachment/attachment.component.ts            | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/alfa-client/libs/design-system/src/lib/attachment/attachment.component.ts b/alfa-client/libs/design-system/src/lib/attachment/attachment.component.ts
index d758743421..3e3b1d8cb0 100644
--- a/alfa-client/libs/design-system/src/lib/attachment/attachment.component.ts
+++ b/alfa-client/libs/design-system/src/lib/attachment/attachment.component.ts
@@ -24,9 +24,12 @@ import { SpinnerIconComponent } from '../icons/spinner-icon/spinner-icon.compone
       <ods-spinner-icon *ngIf="isLoading && !isError" size="large" />
     </div>
     <div class="flex grow flex-col items-start break-all text-start text-text">
-      <p class="text-sm" [ngClass]="isError && 'text-error'">
+      <p *ngIf="!isError && caption" class="text-sm">
         {{ caption }}
       </p>
+      <p *ngIf="isError && errorCaption" class="text-sm text-error">
+        {{ errorCaption }}
+      </p>
       <p *ngIf="description && !isError" class="text-xs text-text/65">
         {{ description }}
       </p>
@@ -38,7 +41,8 @@ import { SpinnerIconComponent } from '../icons/spinner-icon/spinner-icon.compone
   </button>`,
 })
 export class AttachmentComponent {
-  @Input({ required: true }) caption!: string;
+  @Input() caption: string = '';
+  @Input() errorCaption: string = '';
   @Input() fileType: string = '';
   @Input() description = '';
   @Input() isLoading: boolean = false;
-- 
GitLab