UX: Apply `no-text` to buttons without labels and content

This commit is contained in:
Robin Ward 2016-06-08 11:14:36 -04:00
parent c275a68daf
commit e621e33321
3 changed files with 10 additions and 4 deletions

View File

@ -4,8 +4,14 @@ import { iconNode } from 'discourse/helpers/fa-icon';
export default createWidget('button', { export default createWidget('button', {
tagName: 'button.widget-button', tagName: 'button.widget-button',
buildClasses() { buildClasses(attrs) {
if (this.attrs.className) { return this.attrs.className; } const className = this.attrs.className || '';
if (!attrs.label && !attrs.contents) {
return className + ' no-text';
}
return className;
}, },
buildAttributes() { buildAttributes() {

View File

@ -29,7 +29,7 @@ createWidget('topic-admin-menu-button', {
const result = []; const result = [];
result.push(this.attach('button', { result.push(this.attach('button', {
className: 'btn no-text' + (attrs.fixed ? " show-topic-admin" : ""), className: 'btn ' + (attrs.fixed ? " show-topic-admin" : ""),
title: 'topic_admin_menu', title: 'topic_admin_menu',
icon: 'wrench', icon: 'wrench',
action: 'showAdminMenu', action: 'showAdminMenu',

View File

@ -52,7 +52,7 @@ export default createWidget('topic-notifications-button', {
if (this.attrs.showFullTitle) { if (this.attrs.showFullTitle) {
button.label = `topic.notifications.${details.key}.title`; button.label = `topic.notifications.${details.key}.title`;
} else { } else {
button.className = 'btn no-text notifications-dropdown'; button.className = 'btn notifications-dropdown';
} }
return this.attach('button', button); return this.attach('button', button);