Skip to content

A platform for community discussion. Free, open, simple.

UX: transparent button modifiers (#36252)

chapoiafa873fcc12c
diff --git a/app/assets/stylesheets/common/components/buttons.scss b/app/assets/stylesheets/common/components/buttons.scss
index f44fc6ffbc6..827b1465300 100644
--- a/app/assets/stylesheets/common/components/buttons.scss
+++ b/app/assets/stylesheets/common/components/buttons.scss
@@ -512,15 +512,22 @@
}
}
- &.btn-primary {
+ /* The full classname is the dld way of combining transparent buttons with colours – no longer use like this
+ Use the --modifiers approach instead
+ */
+
+ &.btn-primary,
+ &.--primary {
@include btn-colors("primary");
}
- &.btn-danger {
+ &.btn-danger,
+ &.--danger {
@include btn-colors("danger");
}
- &.btn-success {
+ &.btn-success,
+ &.--success {
@include btn-colors("success");
}
}
diff --git a/frontend/discourse/admin/components/admin-flag-item.gjs b/frontend/discourse/admin/components/admin-flag-item.gjs
index b89d6ba906b..2009d0df547 100644
--- a/frontend/discourse/admin/components/admin-flag-item.gjs
+++ b/frontend/discourse/admin/components/admin-flag-item.gjs
@@ -204,7 +204,7 @@ export default class AdminFlagItem extends Component {
<DButton
@label="admin.config_areas.flags.delete"
@icon="trash-can"
- class="btn-transparent btn-danger admin-flag-item__delete"
+ class="btn-transparent --danger admin-flag-item__delete"
@action={{this.delete}}
@disabled={{not this.canDelete}}
@title={{this.deleteTitle}}
diff --git a/frontend/discourse/admin/components/admin-user-field-item.gjs b/frontend/discourse/admin/components/admin-user-field-item.gjs
index 42ecf13cc74..a9e294aa48b 100644
--- a/frontend/discourse/admin/components/admin-user-field-item.gjs
+++ b/frontend/discourse/admin/components/admin-user-field-item.gjs
@@ -126,7 +126,7 @@ export default class AdminUserFieldItem extends Component {
<DButton
@label="admin.config_areas.user_fields.delete"
@icon="trash-can"
- class="btn-transparent btn-danger admin-user_field-item__delete"
+ class="btn-transparent --danger admin-user_field-item__delete"
@action={{this.destroy}}
/>
</dropdown.item>
diff --git a/frontend/discourse/admin/components/color-palette-list-item.gjs b/frontend/discourse/admin/components/color-palette-list-item.gjs
index 88ae70ca9a0..f344193da63 100644
--- a/frontend/discourse/admin/components/color-palette-list-item.gjs
+++ b/frontend/discourse/admin/components/color-palette-list-item.gjs
@@ -258,7 +258,7 @@ export default class ColorPaletteListItem extends Component {
}}
@icon="trash-can"
@label="admin.customize.delete"
- class="btn-transparent btn-danger"
+ class="btn-transparent --danger"
/>
</dropdown.item>
{{/if}}
diff --git a/frontend/discourse/admin/components/embeddable-host.gjs b/frontend/discourse/admin/components/embeddable-host.gjs
index 936e41af820..58e0314d569 100644
--- a/frontend/discourse/admin/components/embeddable-host.gjs
+++ b/frontend/discourse/admin/components/embeddable-host.gjs
@@ -99,7 +99,7 @@ export default class EmbeddableHost extends Component {
@action={{this.delete}}
@label="admin.embedding.delete"
@icon="trash-can"
- class="btn-transparent btn-danger admin-embeddable-host-item__delete"
+ class="btn-transparent --danger admin-embeddable-host-item__delete"
/>
</dropdown.item>
</DropdownMenu>
diff --git a/frontend/discourse/admin/components/themes-grid-card.gjs b/frontend/discourse/admin/components/themes-grid-card.gjs
index abc4e9eb5b3..009a3ffa8e9 100644
--- a/frontend/discourse/admin/components/themes-grid-card.gjs
+++ b/frontend/discourse/admin/components/themes-grid-card.gjs
@@ -307,7 +307,7 @@ export default class ThemeCard extends Component {
@label="admin.customize.delete"
@icon="trash-can"
@disabled={{this.destroyDisabled}}
- class="theme-card__button btn-danger btn-transparent delete"
+ class="theme-card__button btn-transparent --danger delete"
/>
</dropdown.item>
</DropdownMenu>
diff --git a/frontend/discourse/admin/templates/admin-permalinks/index.gjs b/frontend/discourse/admin/templates/admin-permalinks/index.gjs
index 18579c8a6a4..6f566b2bdc1 100644
--- a/frontend/discourse/admin/templates/admin-permalinks/index.gjs
+++ b/frontend/discourse/admin/templates/admin-permalinks/index.gjs
@@ -102,7 +102,7 @@ export default <template>
<DButton
@action={{fn @controller.destroyRecord pl}}
@icon="trash-can"
- class="btn-transparent btn-danger admin-permalink-item__delete"
+ class="btn-transparent --danger admin-permalink-item__delete"
@label="admin.config_areas.permalinks.delete"
/>
</dropdown.item>
diff --git a/frontend/discourse/admin/templates/admin/backups/index.gjs b/frontend/discourse/admin/templates/admin/backups/index.gjs
index 46f34ca81c9..3643bd8b99f 100644
--- a/frontend/discourse/admin/templates/admin/backups/index.gjs
+++ b/frontend/discourse/admin/templates/admin/backups/index.gjs
@@ -106,7 +106,7 @@ export default <template>
@disabled={{@controller.status.isOperationRunning}}
@title={{@controller.deleteTitle}}
@label="admin.backups.operations.destroy.title"
- class="btn-transparent btn-danger backup-item-row__delete"
+ class="btn-transparent --danger backup-item-row__delete"
/>
</dropdown.item>
</DropdownMenu>
diff --git a/frontend/discourse/app/components/modal/post-translations.gjs b/frontend/discourse/app/components/modal/post-translations.gjs
index f3048976ee9..bdc30fd1e52 100644
--- a/frontend/discourse/app/components/modal/post-translations.gjs
+++ b/frontend/discourse/app/components/modal/post-translations.gjs
@@ -133,7 +133,7 @@ export default class PostTranslationsModal extends Component {
<td class="post-translations-modal__edit-action">
{{#if this.canLocalizePost}}
<DButton
- class="btn-primary btn-transparent"
+ class="btn-transparent --primary"
@icon="pencil"
@label="post.localizations.table.edit"
@action={{fn this.editLocalization localization}}
@@ -143,7 +143,7 @@ export default class PostTranslationsModal extends Component {
<td class="post-translations-modal__delete-action">
{{#if this.canLocalizePost}}
<DButton
- class="btn-danger btn-transparent"
+ class="btn-transparent --danger"
@icon="trash-can"
@label="post.localizations.table.delete"
@action={{fn this.delete localization.locale}}
diff --git a/frontend/discourse/app/components/reviewable-refresh/timeline.gjs b/frontend/discourse/app/components/reviewable-refresh/timeline.gjs
index 1b929b5ba7e..7bb2583cbfd 100644
--- a/frontend/discourse/app/components/reviewable-refresh/timeline.gjs
+++ b/frontend/discourse/app/components/reviewable-refresh/timeline.gjs
@@ -276,7 +276,7 @@ export default class ReviewableTimeline extends Component {
@icon="trash-can"
@title="review.notes.delete_note"
@action={{fn this.deleteNote event.noteId}}
- class="btn-transparent btn-danger timeline-event__delete-note btn-transparent"
+ class="btn-transparent --danger timeline-event__delete-note btn-transparent"
/>
</div>
{{/if}}
diff --git a/frontend/discourse/app/components/topic-list/header/bulk-select-cell.gjs b/frontend/discourse/app/components/topic-list/header/bulk-select-cell.gjs
index 313c41ccb16..fbfb671d9cc 100644
--- a/frontend/discourse/app/components/topic-list/header/bulk-select-cell.gjs
+++ b/frontend/discourse/app/components/topic-list/header/bulk-select-cell.gjs
@@ -8,7 +8,7 @@ const BulkSelectCell = <template>
<button
{{on "click" @bulkSelectHelper.toggleBulkSelect}}
title={{i18n "topics.bulk.toggle"}}
- class="btn-transparent bulk-select no-text btn-primary"
+ class="btn-transparent bulk-select no-text --primary"
>
{{icon "list-check"}}
</button>
diff --git a/frontend/discourse/app/templates/user-invited/show.gjs b/frontend/discourse/app/templates/user-invited/show.gjs
index 21edc8a1fdb..8dbbe5a82a2 100644
--- a/frontend/discourse/app/templates/user-invited/show.gjs
+++ b/frontend/discourse/app/templates/user-invited/show.gjs
@@ -310,7 +310,7 @@ export default <template>
invite
}}
@icon="trash-can"
- class="btn-transparent btn-danger"
+ class="btn-transparent --danger"
@label={{if
invite.destroyed
"user.invited.removed"
diff --git a/frontend/discourse/tests/integration/components/user-invited-show-test.js b/frontend/discourse/tests/integration/components/user-invited-show-test.js
index 0bd273c8762..6d871d91050 100644
--- a/frontend/discourse/tests/integration/components/user-invited-show-test.js
+++ b/frontend/discourse/tests/integration/components/user-invited-show-test.js
@@ -19,7 +19,7 @@ acceptance("User invites", function (needs) {
await click(
"table.user-invite-list tbody tr:nth-child(1) .d-icon-ellipsis-vertical"
);
- assert.dom(".btn-danger").exists();
+ assert.dom(".--danger").exists();
assert
.dom(
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
index a2f55f24d1b..ee17f43cc1e 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.gjs
@@ -48,7 +48,7 @@ const ChatChannelCard = <template>
<ToggleChannelMembershipButton
@channel={{@channel}}
@options={{hash
- leaveClass="btn-transparent btn-danger chat-channel-card__leave-btn"
+ leaveClass="btn-transparent --danger chat-channel-card__leave-btn"
labelType="short"
}}
/>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs
index 3b6be8f59d3..738d2d3d03c 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/thread-settings.gjs
@@ -59,7 +59,7 @@ export default class ChatModalThreadSettings extends Component {
@disabled={{this.buttonDisabled}}
@action={{this.saveThread}}
@label="chat.save"
- class="btn-transparent btn-primary"
+ class="btn-transparent --primary"
/>
</:headerPrimaryAction>
<:body>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries-tooltip.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries-tooltip.gjs
index 69da9de43c4..8824f5aaf96 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries-tooltip.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries-tooltip.gjs
@@ -31,7 +31,7 @@ export default class AiSearchDiscoveriesTooltip extends Component {
<div class="ai-search-discoveries-tooltip__actions">
<DButton
- class="btn-transparent btn-primary"
+ class="btn-transparent --primary"
@label="discourse_ai.discobot_discoveries.tooltip.actions.info"
@href="https://meta.discourse.org/t/conversational-ai-search-coming-to-discourse-ai/355939"
/>
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs
index 455ff53c3e6..64482295179 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs
@@ -368,7 +368,7 @@ export default class DiscoursePostEventMoreMenu extends Component {
@label="discourse_post_event.close_event"
@action={{this.closeEvent}}
@disabled={{this.isSavingEvent}}
- class="btn-transparent btn-danger"
+ class="btn-transparent --danger"
/>
</dropdown.item>
{{/unless}}
diff --git a/spec/system/page_objects/pages/admin_customize_themes_config_area.rb b/spec/system/page_objects/pages/admin_customize_themes_config_area.rb
index 28a609fa7ad..aa91be7be26 100644
--- a/spec/system/page_objects/pages/admin_customize_themes_config_area.rb
+++ b/spec/system/page_objects/pages/admin_customize_themes_config_area.rb
@@ -55,7 +55,7 @@ module PageObjects
def has_disabled_delete_button?(theme)
open_theme_menu(theme)
- has_css?(".btn-danger.delete[disabled]")
+ has_css?(".--danger.delete[disabled]")
end
def has_themes?(names)