From 729ad2723eab02bd5d1a848d8f3a530f49db7f3c Mon Sep 17 00:00:00 2001 From: Paola De Bartolo Date: Mon, 30 Sep 2024 17:24:16 -0300 Subject: [PATCH] fix: prevent rendering of empty label Close #23 --- .../META-INF/resources/frontend/src/fc-badge-list.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts b/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts index 624a10f..e831b5d 100644 --- a/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts +++ b/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts @@ -85,6 +85,10 @@ export class BadgeList extends ResizeMixin(ThemableMixin(LitElement)) { margin: var(--badge-list-badges-margin); } + :host(:not([has-label])) [part='label']{ + display:none; + } + [part="label"] { align-self: flex-start; color: var(--badge-list-label-color); @@ -230,5 +234,12 @@ export class BadgeList extends ResizeMixin(ThemableMixin(LitElement)) { `; } + + update(_changedProperties: Map) { + if (_changedProperties.has('label')) { + this.toggleAttribute('has-label', this.label != null); + } + super.update(_changedProperties); + } } \ No newline at end of file