This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/templates/components/d-button.hbs
Joffrey JAFFEUX 5b6cdd6fb5
DEV: adds a loading property to d-button (#9072)
Usage:

```
{{d-button icon="times" label="foo.bar" isLoading=true}}
```

Note that  a button loading without an icon will shrink text size to prevent button to jump in size.

A button while loading is disabled.
2020-03-30 23:17:00 +02:00

18 lines
356 B
Handlebars

{{#if icon}}
{{#if isLoading}}
{{d-icon "spinner" class="loading-icon"}}
{{else}}
{{d-icon icon}}
{{/if}}
{{else}}
{{#if isLoading}}
{{d-icon "spinner" class="loading-icon"}}
{{/if}}
{{/if}}
{{#if translatedLabel}}
<span class='d-button-label'>{{html-safe translatedLabel}}{{#if ellipsis}}&hellip;{{/if}}</span>
{{/if}}
{{yield}}