From d8b1c3c807050c239684324aeede20cea23a7f10 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 6 May 2024 20:52:11 +0200 Subject: [PATCH] DEV: Don't add 0-width char if there's no icon in d-button (#26880) Previously, if you supplied your own content to DButton it would still add the character: ```hbs my text ``` ```html ``` --- .../discourse/app/components/d-button.gjs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/d-button.gjs b/app/assets/javascripts/discourse/app/components/d-button.gjs index 603abfd21bf..d0b0147010a 100644 --- a/app/assets/javascripts/discourse/app/components/d-button.gjs +++ b/app/assets/javascripts/discourse/app/components/d-button.gjs @@ -178,15 +178,13 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView { > {{#if @isLoading}} {{~icon "spinner" class="loading-icon"~}} - {{else}} - {{#if @icon}} - {{#if @ariaHidden}} - - {{else}} + {{else if @icon}} + {{#if @ariaHidden}} + + {{else}} + {{~icon @icon~}} {{/if}} {{/if}} @@ -197,7 +195,7 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView { … {{~/if~}} - {{~else~}} + {{~else if (or @icon @isLoading)~}} ​ {{! Zero-width space character, so icon-only button height = regular button height }} {{~/if~}}