mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 12:13:58 -06:00
DEV: Use concat-class
helper when setting class for DButton
(#21998)
Why this change? Currently, we're interpolating within a string to set the class for the `DButton` component. However, the interpolation and formatting of our handlebars templates result in unnecessary spaces being added to the class attribute. ``` <button class="sidebar-section-header sidebar-section-header-collapsable btn-flat btn no-text " aria-controls="sidebar-section-content-categories" aria-expanded="true" title="Toggle section" type="button"> ... </button> ``` This makes the HTML elements for buttons hard to read especially when we're debugging issues in the console. After this change, this is what we get: ``` <button class="sidebar-section-header sidebar-section-header-collapsable btn-flat btn no-text" aria-controls="sidebar-section-content-categories" aria-expanded="true" title="Toggle section" type="button"> ... </button> ```
This commit is contained in:
parent
7dab8e7e22
commit
b4611114f9
@ -1,11 +1,13 @@
|
||||
{{! template-lint-disable no-down-event-binding }}
|
||||
<button
|
||||
{{! For legacy compatibility. Prefer passing class as attributes. }}
|
||||
class="{{@class}}
|
||||
{{if @isLoading 'is-loading'}}
|
||||
{{if this.btnLink 'btn-link' 'btn'}}
|
||||
{{if this.noText 'no-text'}}
|
||||
{{this.btnType}}"
|
||||
class={{concat-class
|
||||
@class
|
||||
(if @isLoading "is-loading")
|
||||
(if this.btnLink "btn-link" "btn")
|
||||
(if this.noText "no-text")
|
||||
this.btnType
|
||||
}}
|
||||
{{! For legacy compatibility. Prefer passing these as html attributes. }}
|
||||
id={{@id}}
|
||||
form={{@form}}
|
||||
|
Loading…
Reference in New Issue
Block a user