From 6fed35760593c2a6e11634e77e91c72d4ee99557 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 27 May 2015 16:21:15 +0930 Subject: [PATCH] Allow ActionButtons to be disabled --- js/lib/components/action-button.js | 6 ++++++ less/lib/alerts.less | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/js/lib/components/action-button.js b/js/lib/components/action-button.js index 505d600cb..6971ddc92 100644 --- a/js/lib/components/action-button.js +++ b/js/lib/components/action-button.js @@ -12,6 +12,12 @@ export default class ActionButton extends Component { var label = attrs.label; delete attrs.label; + if (attrs.disabled) { + attrs.className = (attrs.className || '')+' disabled'; + delete attrs.onclick; + delete attrs.disabled; + } + attrs.href = attrs.href || 'javascript:;'; return m('a'+(iconName ? '.has-icon' : ''), attrs, [ iconName ? icon(iconName+' icon') : '', diff --git a/less/lib/alerts.less b/less/lib/alerts.less index 78da2b2b2..e97169b3f 100644 --- a/less/lib/alerts.less +++ b/less/lib/alerts.less @@ -38,6 +38,12 @@ text-transform: uppercase; font-size: 12px; font-weight: bold; + + &.disabled { + cursor: default; + text-decoration: none; + opacity: 0.5; + } } & .btn { margin: -10px;