From 5f84ac2590e602d0c20264f4f7205b730ed3cd16 Mon Sep 17 00:00:00 2001 From: Maude LAFLAMME Date: Wed, 18 Jan 2023 16:48:21 -0500 Subject: [PATCH] fix(file): remove unnecessary margin and fix error when no guiding test is provided. close #117. Signed-off-by: Maude LAFLAMME (cherry picked from commit a43dc66562aaf9ec8c76f3be66ba8bd61fc8be12) --- .../angular-ui/src/lib/file/file-input.component.scss | 5 +++++ projects/angular-ui/src/lib/file/file-input.component.ts | 8 ++++++-- .../angular-ui/src/lib/file/file-preview.component.scss | 3 --- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/angular-ui/src/lib/file/file-input.component.scss b/projects/angular-ui/src/lib/file/file-input.component.scss index df8d1fae..555e9050 100644 --- a/projects/angular-ui/src/lib/file/file-input.component.scss +++ b/projects/angular-ui/src/lib/file/file-input.component.scss @@ -66,6 +66,11 @@ bao-file-input { } } } + .bao-file-preview { + &:first-child { + margin-top: 1rem; + } + } .bao-error { margin-top: 0.5rem; } diff --git a/projects/angular-ui/src/lib/file/file-input.component.ts b/projects/angular-ui/src/lib/file/file-input.component.ts index a6387675..cbf1c615 100644 --- a/projects/angular-ui/src/lib/file/file-input.component.ts +++ b/projects/angular-ui/src/lib/file/file-input.component.ts @@ -273,10 +273,14 @@ export class BaoFileInputComponent private setDescribedByAttribute(): void { const helperText = Array.from(this.nativeElement.children).find( (el: HTMLElement) => el.localName === 'bao-guiding-text' - ).firstElementChild; + ); if (helperText) { this._helperTextId = `bao-guiding-text-${fileTextUniqueId++}`; - this.renderer.setAttribute(helperText, 'id', this._helperTextId); + this.renderer.setAttribute( + helperText.firstElementChild, + 'id', + this._helperTextId + ); const inputElement = Array.from(this.nativeElement.children) .find((el: HTMLElement) => el.className == 'file-drop-zone') .children.item(1); diff --git a/projects/angular-ui/src/lib/file/file-preview.component.scss b/projects/angular-ui/src/lib/file/file-preview.component.scss index 5cd934ad..19189e42 100644 --- a/projects/angular-ui/src/lib/file/file-preview.component.scss +++ b/projects/angular-ui/src/lib/file/file-preview.component.scss @@ -8,9 +8,6 @@ padding-top: 0.625rem; padding-bottom: 0.625rem; list-style-type: none; - &:first-child { - margin-top: 1rem; - } > .bao-file-info { display: flex; align-items: center;