From f72d118bec94a808efcec1f1b16fb6e055f9f1fd Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Sat, 8 Aug 2020 16:14:10 -0400 Subject: [PATCH] cleanup: common/components/Button --- js/src/common/components/Button.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/common/components/Button.js b/js/src/common/components/Button.js index 15eadc7b9..b9bd91bc4 100644 --- a/js/src/common/components/Button.js +++ b/js/src/common/components/Button.js @@ -1,5 +1,6 @@ import Component from '../Component'; import icon from '../helpers/icon'; +import classList from '../utils/classList'; import extract from '../utils/extract'; import extractText from '../utils/extractText'; import LoadingIndicator from './LoadingIndicator'; @@ -24,7 +25,6 @@ export default class Button extends Component { view(vnode) { const attrs = Object.assign({}, this.attrs); - attrs.className = attrs.className || ''; attrs.type = attrs.type || 'button'; // If a tooltip was provided for buttons without additional content, we also @@ -39,14 +39,14 @@ export default class Button extends Component { } const iconName = extract(attrs, 'icon'); - if (iconName) attrs.className += ' hasIcon'; const loading = extract(attrs, 'loading'); if (attrs.disabled || loading) { - attrs.className += ' disabled' + (loading ? ' loading' : ''); delete attrs.onclick; } + attrs.className = classList([attrs.className, iconName && 'hasIcon', attrs.disabled && 'disabled', loading && 'loading']); + return ; }