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
<DButton>my text</DButton>
```

```html
<button>&#8203; my text</button>
```
This commit is contained in:
Jarek Radosz 2024-05-06 20:52:11 +02:00 committed by GitHub
parent 378faf060d
commit d8b1c3c807
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -178,15 +178,13 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
> >
{{#if @isLoading}} {{#if @isLoading}}
{{~icon "spinner" class="loading-icon"~}} {{~icon "spinner" class="loading-icon"~}}
{{else}} {{else if @icon}}
{{#if @icon}} {{#if @ariaHidden}}
{{#if @ariaHidden}} <span aria-hidden="true">
<span aria-hidden="true">
{{~icon @icon~}}
</span>
{{else}}
{{~icon @icon~}} {{~icon @icon~}}
{{/if}} </span>
{{else}}
{{~icon @icon~}}
{{/if}} {{/if}}
{{/if}} {{/if}}
@ -197,7 +195,7 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
&hellip; &hellip;
{{~/if~}} {{~/if~}}
</span> </span>
{{~else~}} {{~else if (or @icon @isLoading)~}}
&#8203; &#8203;
{{! Zero-width space character, so icon-only button height = regular button height }} {{! Zero-width space character, so icon-only button height = regular button height }}
{{~/if~}} {{~/if~}}