Skip to content

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

UX: rework button classes (#34882)

chapoi759fc040419d
diff --git a/app/assets/javascripts/admin/addon/components/admin-search-filters.gjs b/app/assets/javascripts/admin/addon/components/admin-search-filters.gjs
index 18c55173d06..2617669f54c 100644
--- a/app/assets/javascripts/admin/addon/components/admin-search-filters.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-search-filters.gjs
@@ -9,7 +9,7 @@ const AdminSearchFilters = <template>
<span class={{concat "admin-search__filter --" type}}>
<DButton
class={{concatClass
- "btn-small admin-search__filter-item"
+ "btn-default btn-small admin-search__filter-item"
(if (get @typeFilters type) "is-active")
}}
@translatedLabel={{i18n
diff --git a/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs b/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs
index 478dac519c8..96c7c893c6c 100644
--- a/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs
+++ b/app/assets/javascripts/admin/addon/components/inline-edit-checkbox.gjs
@@ -39,12 +39,12 @@ export default class InlineEditCheckbox extends Component {
<DButton
@action={{fn @action this.value}}
@icon="check"
- class="btn-primary btn-small submit-edit"
+ class="btn-success btn-small submit-edit"
/>
<DButton
@action={{this.reset}}
@icon="xmark"
- class="btn-small cancel-edit"
+ class="btn-danger btn-small cancel-edit"
/>
{{/if}}
</div>
diff --git a/app/assets/javascripts/admin/addon/components/modal/install-theme.gjs b/app/assets/javascripts/admin/addon/components/modal/install-theme.gjs
index efc924b6856..abe4ec51217 100644
--- a/app/assets/javascripts/admin/addon/components/modal/install-theme.gjs
+++ b/app/assets/javascripts/admin/addon/components/modal/install-theme.gjs
@@ -347,7 +347,7 @@ export default class InstallThemeModal extends Component {
<span>{{i18n "admin.customize.theme.installed"}}</span>
{{else}}
<DButton
- class="btn-small"
+ class="btn-default btn-small"
@label="admin.customize.theme.install"
@disabled={{this.installDisabled}}
@icon="upload"
diff --git a/app/assets/javascripts/admin/addon/templates/admin-customize-themes/show.gjs b/app/assets/javascripts/admin/addon/templates/admin-customize-themes/show.gjs
index d2ce712cb6f..98d7a3ff589 100644
--- a/app/assets/javascripts/admin/addon/templates/admin-customize-themes/show.gjs
+++ b/app/assets/javascripts/admin/addon/templates/admin-customize-themes/show.gjs
@@ -53,7 +53,7 @@ export default RouteTemplate(
<DButton
@action={{@controller.cancelEditingName}}
@icon="xmark"
- class="btn-small cancel-edit"
+ class="btn-default btn-small cancel-edit"
/>
</div>
{{else}}
diff --git a/app/assets/javascripts/admin/addon/templates/admin-permalinks/index.gjs b/app/assets/javascripts/admin/addon/templates/admin-permalinks/index.gjs
index a99f118c793..d65fc0af24b 100644
--- a/app/assets/javascripts/admin/addon/templates/admin-permalinks/index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/admin-permalinks/index.gjs
@@ -3,7 +3,6 @@ import RouteTemplate from "ember-route-template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DropdownMenu from "discourse/components/dropdown-menu";
-import FlatButton from "discourse/components/flat-button";
import TextField from "discourse/components/text-field";
import categoryLink from "discourse/helpers/category-link";
import concatClass from "discourse/helpers/concat-class";
@@ -51,10 +50,11 @@ export default RouteTemplate(
}}
>
<td class="d-table__cell --overview">
- <FlatButton
+ <DButton
@title="admin.permalink.copy_to_clipboard"
@icon="far-clipboard"
@action={{fn @controller.copyUrl pl}}
+ class="btn-flat"
/>
<span
id="admin-permalink-{{pl.id}}"
diff --git a/app/assets/javascripts/discourse/app/components/bookmark-list.gjs b/app/assets/javascripts/discourse/app/components/bookmark-list.gjs
index b3ca4fdc10d..5f7e3603220 100644
--- a/app/assets/javascripts/discourse/app/components/bookmark-list.gjs
+++ b/app/assets/javascripts/discourse/app/components/bookmark-list.gjs
@@ -11,7 +11,6 @@ import { and } from "truth-helpers";
import BookmarkActionsDropdown from "discourse/components/bookmark-actions-dropdown";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
-import FlatButton from "discourse/components/flat-button";
import LoadMore from "discourse/components/load-more";
import BookmarkModal from "discourse/components/modal/bookmark";
import PluginOutlet from "discourse/components/plugin-outlet";
@@ -214,9 +213,9 @@ export default class BookmarkList extends Component {
<PluginOutlet @name="bookmark-list-table-header">
{{#if this.bulkSelectEnabled}}
<th class="bulk-select topic-list-data">
- <FlatButton
+ <DButton
@action={{this.toggleBulkSelect}}
- @class="bulk-select"
+ class="bulk-select btn-flat"
@icon="list-check"
@title="bookmarks.bulk.toggle"
/>
@@ -252,9 +251,9 @@ export default class BookmarkList extends Component {
/>
</span>
{{else}}
- <FlatButton
+ <DButton
@action={{this.toggleBulkSelect}}
- @class="bulk-select"
+ class="btn-flat bulk-select"
@icon="list-check"
@title="bookmarks.bulk.toggle"
/>
diff --git a/app/assets/javascripts/discourse/app/components/d-button.gjs b/app/assets/javascripts/discourse/app/components/d-button.gjs
index a4140f58155..4ba8d6e37e7 100644
--- a/app/assets/javascripts/discourse/app/components/d-button.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-button.gjs
@@ -32,8 +32,6 @@ export default class DButton extends Component {
get btnType() {
if (this.args.icon) {
return this.computedLabel ? "btn-icon-text" : "btn-icon";
- } else if (this.computedLabel) {
- return "btn-text";
}
}
diff --git a/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs b/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs
index 31965e885d5..3d3316850cb 100644
--- a/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs
@@ -3,7 +3,7 @@ import DButton from "discourse/components/d-button";
export const DPageActionButton = <template>
<DButton
- class="d-page-action-button btn-small"
+ class="d-page-action-button btn-small btn-default"
...attributes
@action={{@action}}
@route={{@route}}
diff --git a/app/assets/javascripts/discourse/app/components/flat-button.gjs b/app/assets/javascripts/discourse/app/components/flat-button.gjs
deleted file mode 100644
index 3e2b2f69971..00000000000
--- a/app/assets/javascripts/discourse/app/components/flat-button.gjs
+++ /dev/null
@@ -1,38 +0,0 @@
-/* eslint-disable ember/no-classic-components */
-import Component from "@ember/component";
-import {
- attributeBindings,
- classNames,
- tagName,
-} from "@ember-decorators/component";
-import icon from "discourse/helpers/d-icon";
-import discourseComputed from "discourse/lib/decorators";
-import { i18n } from "discourse-i18n";
-
-@tagName("button")
-@classNames("btn-flat")
-@attributeBindings("disabled", "resolvedTitle:title")
-export default class FlatButton extends Component {
- @discourseComputed("title", "translatedTitle")
- resolvedTitle(title, translatedTitle) {
- if (title) {
- return i18n(title);
- } else if (translatedTitle) {
- return translatedTitle;
- }
- }
-
- keyDown(event) {
- if (event.key === "Enter") {
- this.action?.();
- return false;
- }
- }
-
- click() {
- this.action?.();
- return false;
- }
-
- <template>{{icon this.icon}}</template>
-}
diff --git a/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjs b/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjs
index 9d0a62ebb30..84dd32f10dc 100644
--- a/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjs
+++ b/app/assets/javascripts/discourse/app/components/reviewable-claimed-topic.gjs
@@ -54,14 +54,14 @@ export default class ReviewableClaimedTopic extends Component {
@icon="xmark"
@action={{this.unclaim}}
@title="review.unclaim.help"
- class="btn-small unclaim"
+ class="btn-default btn-small unclaim"
/>
{{else}}
<DButton
@icon="user-plus"
@title="review.claim.title"
@action={{this.claim}}
- class="btn-small claim"
+ class="btn-default btn-small claim"
/>
{{/if}}
</div>
diff --git a/app/assets/javascripts/discourse/app/components/search-menu.gjs b/app/assets/javascripts/discourse/app/components/search-menu.gjs
index 15debc838b9..d03a860352f 100644
--- a/app/assets/javascripts/discourse/app/components/search-menu.gjs
+++ b/app/assets/javascripts/discourse/app/components/search-menu.gjs
@@ -425,7 +425,7 @@ export default class SearchMenu extends Component {
@label="search.in_this_topic"
@title="search.in_this_topic_tooltip"
@action={{this.clearTopicContext}}
- class="btn-small search-context"
+ class="btn-default btn-small search-context"
/>
{{else if this.inPMInboxContext}}
<DButton
@@ -433,7 +433,7 @@ export default class SearchMenu extends Component {
@label="search.in_messages"
@title="search.in_messages_tooltip"
@action={{this.clearPMInboxContext}}
- class="btn-small search-context"
+ class="btn-default btn-small search-context"
/>
{{/if}}
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/bulk-select-cell.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/bulk-select-cell.gjs
index a46f13d1dd4..f02c4087195 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/header/bulk-select-cell.gjs
+++ b/app/assets/javascripts/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-flat bulk-select"
+ class="btn-transparent bulk-select no-text"
>
{{icon "list-check"}}
</button>
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/header/sortable-column.gjs b/app/assets/javascripts/discourse/app/components/topic-list/header/sortable-column.gjs
index e45fa3f113f..a98a6afca90 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/header/sortable-column.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/header/sortable-column.gjs
@@ -88,7 +88,7 @@ export default class SortableColumn extends Component {
<button
{{on "click" @bulkSelectHelper.toggleBulkSelect}}
title={{i18n "topics.bulk.toggle"}}
- class="btn-flat bulk-select"
+ class="btn-transparent bulk-select no-text"
>
{{icon "list-check"}}
</button>
diff --git a/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs b/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs
index c0a8180cf53..8d68685e483 100644
--- a/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-localized-content-toggle.gjs
@@ -45,7 +45,7 @@ export default class TopicLocalizedContentToggle extends Component {
@title={{this.title}}
class={{concatClass
"btn btn-default btn-toggle-localized-content no-text"
- (unless this.showingOriginal "btn-active")
+ (unless this.showingOriginal "--active")
}}
@action={{this.showOriginal}}
/>
diff --git a/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs b/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs
index b2e32078e43..2d33413f2f8 100644
--- a/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-timeline/container.gjs
@@ -649,7 +649,7 @@ export default class TopicTimelineScrollArea extends Component {
@icon="layer-group"
@label="summary.short_label"
title={{i18n "summary.short_title"}}
- class="show-summary btn-small"
+ class="show-summary btn-default btn-small"
/>
{{/if}}
diff --git a/app/assets/javascripts/discourse/app/templates/user-invited/show.gjs b/app/assets/javascripts/discourse/app/templates/user-invited/show.gjs
index f8d34da86ee..6e102caaebb 100644
--- a/app/assets/javascripts/discourse/app/templates/user-invited/show.gjs
+++ b/app/assets/javascripts/discourse/app/templates/user-invited/show.gjs
@@ -294,7 +294,7 @@ export default RouteTemplate(
@label="user.invited.edit"
@action={{fn @controller.editInvite invite}}
@title="user.invited.edit"
- class="btn-small edit-invite"
+ class="btn-default btn-small edit-invite"
/>
<DMenu
@identifier="invites-menu"
diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.gjs
index 47dea743038..deb907620c4 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.gjs
@@ -25,13 +25,6 @@ module("Integration | Component | d-button", function (hooks) {
assert.dom("button span.d-button-label").exists("has the label");
});
- test("text only button", async function (assert) {
- await render(<template><DButton @label="topic.create" /></template>);
-
- assert.dom("button.btn.btn-text").exists("has all the classes");
- assert.dom("button span.d-button-label").exists("has the label");
- });
-
test("form attribute", async function (assert) {
await render(<template><DButton @form="login-form" /></template>);
@@ -40,7 +33,6 @@ module("Integration | Component | d-button", function (hooks) {
test("link-styled button", async function (assert) {
await render(<template><DButton @display="link" /></template>);
-
assert.dom("button.btn-link:not(.btn)").exists("has the right classes");
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/flat-button-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/flat-button-test.gjs
deleted file mode 100644
index 647cd7939f2..00000000000
--- a/app/assets/javascripts/discourse/tests/integration/components/flat-button-test.gjs
+++ /dev/null
@@ -1,39 +0,0 @@
-import { click, render, triggerKeyEvent } from "@ember/test-helpers";
-import { module, test } from "qunit";
-import FlatButton from "discourse/components/flat-button";
-import { setupRenderingTest } from "discourse/tests/helpers/component-test";
-
-module("Integration | Component | flat-button", function (hooks) {
- setupRenderingTest(hooks);
-
- test("press Enter", async function (assert) {
- const self = this;
-
- this.set("foo", null);
- this.set("action", () => {
- this.set("foo", "bar");
- });
-
- await render(<template><FlatButton @action={{self.action}} /></template>);
-
- await triggerKeyEvent(".btn-flat", "keydown", "Space");
- assert.strictEqual(this.foo, null);
-
- await triggerKeyEvent(".btn-flat", "keydown", "Enter");
- assert.strictEqual(this.foo, "bar");
- });
-
- test("click", async function (assert) {
- const self = this;
-
- this.set("foo", null);
- this.set("action", () => {
- this.set("foo", "bar");
- });
-
- await render(<template><FlatButton @action={{self.action}} /></template>);
-
- await click(".btn-flat");
- assert.strictEqual(this.foo, "bar");
- });
-});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs
index 1e23cb5531d..cb05ca4bf73 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs
@@ -47,19 +47,6 @@ module("Integration | Component | Widget | button", function (hooks) {
assert.dom("button span.d-button-label").exists("it renders the label");
});
- test("text only button", async function (assert) {
- const self = this;
-
- this.set("args", { label: "topic.create" });
-
- await render(
- <template><MountWidget @widget="button" @args={{self.args}} /></template>
- );
-
- assert.dom("button.btn.btn-text").exists("has all the classes");
- assert.dom("button span.d-button-label").exists("has the label");
- });
-
test("translatedLabel", async function (assert) {
const self = this;
diff --git a/app/assets/stylesheets/common/base/header.scss b/app/assets/stylesheets/common/base/header.scss
index 36ad67fe187..1010c83fb54 100644
--- a/app/assets/stylesheets/common/base/header.scss
+++ b/app/assets/stylesheets/common/base/header.scss
@@ -181,10 +181,6 @@
.discourse-no-touch &:hover,
.discourse-no-touch &:focus {
background-color: var(--d-hover);
-
- > .d-icon {
- color: var(--primary-medium);
- }
}
}
diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scss
index 33fc32d4fdb..1e43d89c3e7 100644
--- a/app/assets/stylesheets/common/base/topic-post.scss
+++ b/app/assets/stylesheets/common/base/topic-post.scss
@@ -1503,7 +1503,6 @@ span.mention {
}
.post-notice {
- box-sizing: border-box;
align-items: center;
background-color: var(--tertiary-very-low);
border-top: 1px solid var(--content-border-color);
@@ -1514,6 +1513,7 @@ span.mention {
font-size: var(--font-down-1-rem);
border-radius: var(--d-border-radius);
gap: var(--space-2);
+ box-sizing: border-box;
@include viewport.until(sm) {
margin-bottom: var(--space-4);
diff --git a/app/assets/stylesheets/common/base/topic.scss b/app/assets/stylesheets/common/base/topic.scss
index f9660f4f9ea..e569245a984 100644
--- a/app/assets/stylesheets/common/base/topic.scss
+++ b/app/assets/stylesheets/common/base/topic.scss
@@ -28,6 +28,19 @@
.topic-navigation {
overflow-anchor: none;
+
+ .btn-toggle-localized-content.--active {
+ background-image: linear-gradient(
+ to bottom,
+ rgb(var(--primary-rgb), 0.6) 100%,
+ rgb(var(--primary-rgb), 0.6) 100%
+ );
+ color: var(--d-button-default-text-color--hover);
+
+ .d-icon {
+ color: var(--d-button-default-text-color--hover);
+ }
+ }
}
// timeline
diff --git a/app/assets/stylesheets/common/components/buttons.scss b/app/assets/stylesheets/common/components/buttons.scss
index bb28fef5c67..6ef2d809a94 100644
--- a/app/assets/stylesheets/common/components/buttons.scss
+++ b/app/assets/stylesheets/common/components/buttons.scss
@@ -42,8 +42,8 @@
--d-button-flat-icon-color: var(--primary-low-mid);
--d-button-flat-icon-color--hover: var(--primary);
--d-button-flat-bg-color: transparent;
- --d-button-flat-bg-color--hover: transparent;
- --d-button-flat-bg-color--focus: var(--primary-low);
+ --d-button-flat-bg-color--hover: var(--d-hover);
+ --d-button-flat-bg-color--focus: var(--d-hover);
--d-button-flat-text-color--disabled: var(--primary);
// .btn-flat.close
@@ -68,23 +68,9 @@
$hover-bg-color: var(--d-button-default-bg-color--hover),
$hover-icon-color: var(--d-button-default-icon-color--hover)
) {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- margin: 0;
- font-weight: normal;
color: $text-color;
background-color: $bg-color;
- background-image: linear-gradient(
- to bottom,
- rgb(0, 0, 0, 0),
- rgb(0, 0, 0, 0)
- );
- border-radius: var(--d-button-border-radius);
transition: var(--d-button-transition);
- cursor: pointer;
-
- @include form-item-sizing;
border: var(--d-button-border);
&:visited {
@@ -142,30 +128,6 @@
}
}
- .discourse-no-touch &:active:not(:hover, :focus),
- .discourse-no-touch &.btn-active:not(:hover, :focus),
- &:active:not(:hover, :focus),
- &.btn-active:not(:hover, :focus) {
- @include darken-background($bg-color, 0.6);
- color: $hover-text-color;
-
- .d-icon {
- color: $hover-icon-color;
- }
- }
-
- .discourse-no-touch &:active,
- .discourse-no-touch &.btn-active,
- &:active,
- &.btn-active {
- @include darken-background($bg-color, 0.3);
- color: $hover-text-color;
-
- .d-icon {
- color: $hover-icon-color;
- }
- }
-
&[disabled],
&.disabled {
cursor: not-allowed;
@@ -190,12 +152,10 @@
}
&.is-loading {
- &.btn-text {
- &.btn-small {
- .loading-icon {
- font-size: var(--font-down-1);
- margin-right: 0.2em;
- }
+ &.btn-small {
+ .loading-icon {
+ font-size: var(--font-down-1);
+ margin-right: 0.2em;
}
}
@@ -207,9 +167,75 @@
}
}
-/* Default button */
+/* Generic btn */
.btn {
@include btn;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ margin: 0;
+ font-weight: normal;
+ background-image: linear-gradient(
+ to bottom,
+ rgb(0, 0, 0, 0),
+ rgb(0, 0, 0, 0)
+ );
+ box-sizing: border-box;
+ padding: $vpad $hpad;
+ cursor: pointer;
+ line-height: normal;
+}
+
+/* link button */
+.btn-link {
+ background: transparent;
+ border: 0;
+ padding: 0;
+ color: var(--tertiary);
+
+ @include hover {
+ background-color: transparent;
+ color: var(--tertiary-hover);
+
+ .d-icon {
+ color: var(--tertiary-hover);
+
+ /* For Windows High Contrast (see whcm.scss for more) */
+ @media (forced-colors: active) {
+ color: Highlight;
+ }
+ }
+ }
+
+ &:focus-visible {
+ color: var(--tertiary);
+ background: transparent;
+
+ @include default-focus;
+ }
+
+ &[disabled],
+ &.disabled {
+ color: var(--d-button-transparent-text-color);
+ cursor: not-allowed;
+
+ &:not(.is-loading) {
+ opacity: 0.4;
+ }
+
+ &:hover {
+ background: transparent;
+
+ .d-icon {
+ color: inherit;
+ }
+ }
+ }
+}
+
+/* Default button */
+.btn-default {
+ border-radius: var(--d-button-border-radius);
}
/* Primary button */
@@ -222,6 +248,7 @@
$hover-bg-color: var(--d-button-primary-bg-color--hover),
$hover-icon-color: var(--d-button-primary-icon-color--hover)
);
+ border-radius: var(--d-button-border-radius);
}
/* Danger button */
@@ -235,6 +262,7 @@
$hover-bg-color: var(--d-button-danger-bg-color--hover),
$hover-icon-color: var(--d-button-danger-icon-color--hover)
);
+ border-radius: var(--d-button-border-radius);
}
/* Success button */
@@ -248,6 +276,7 @@
$hover-bg-color: var(--d-button-success-bg-color--hover),
$hover-icon-color: var(--d-button-success-icon-color--hover)
);
+ border-radius: var(--d-button-border-radius);
}
/* Social buttons */
@@ -359,28 +388,17 @@
/* Bonus Buttons */
.btn-flat {
- background: var(--d-button-flat-bg-color);
- transition: var(--d-button-transition);
-
- .d-icon {
- color: var(--d-button-flat-icon-color);
- transition: var(--d-button-transition);
- }
+ @include btn(
+ $text-color: var(--d-button-default-text-color),
+ $bg-color: var(--d-button-flat-bg-color),
+ $icon-color: var(--d-button-flat-icon-color),
+ $hover-text-color: var(--d-button-flat-text-color--hover),
+ $hover-bg-color: var(--d-button-flat-bg-color--hover),
+ $hover-icon-color: var(--d-button-flat-icon-color--hover)
+ );
+ border-radius: var(--d-button-border-radius);
.discourse-no-touch & {
- &:hover,
- &:focus-visible {
- color: var(--d-button-flat-text-color--hover);
-
- .d-icon {
- color: var(--d-button-flat-icon-color--hover);
- }
- }
-
- &:hover {
- background: var(--d-button-flat-bg-color--hover);
- }
-
&:focus-visible {
background: var(--d-button-flat-bg-color--focus);
}
@@ -413,36 +431,6 @@
}
}
- &.btn-text {
- color: var(--d-button-flat-text-color);
-
- &[disabled] {
- &,
- .discourse-no-touch & {
- &:hover,
- &.btn-hover,
- &:focus-visible {
- color: var(--d-button-flat-text-color--disabled);
- }
- }
-
- .discourse-no-touch & {
- &:not([disabled]) {
- &:hover,
- &.btn-hover,
- &:focus-visible {
- color: var(--d-button-flat-text-color--hover);
- }
- }
-
- &:active,
- &.btn-active {
- @include darken-background(transparent, 0.2);
- }
- }
- }
- }
-
&:focus-visible {
outline: none;
background: var(--primary-low);
@@ -457,27 +445,6 @@
}
}
-.btn-link {
- background: transparent;
- border: 0;
- padding: 0;
- color: var(--tertiary);
-
- .discourse-no-touch & {
- &:hover {
- color: var(--tertiary);
- background: transparent;
- }
- }
-
- &:focus-visible {
- color: var(--tertiary);
- background: transparent;
-
- @include default-focus;
- }
-}
-
@mixin btn-colors($btn-type) {
color: var(--d-button-#{$btn-type}-bg-color);
@@ -498,17 +465,18 @@
.btn-transparent {
&,
- &.btn-default,
- &.btn-text,
+ &.btn-default, // preferably NOT used in conjuction with btn-default
&.btn-icon,
&.no-text {
- background: transparent;
+ @include btn(
+ $text-color: var(--d-button-transparent-text-color),
+ $bg-color: transparent,
+ $icon-color: var(--d-button-transparent-icon-color),
+ $hover-text-color: var(--d-button-transparent-text-color--hover),
+ $hover-bg-color: transparent,
+ $hover-icon-color: currentcolor
+ );
border: 0;
- color: var(--d-button-transparent-text-color);
-
- .d-icon {
- color: var(--d-button-transparent-icon-color);
- }
&:focus-visible {
background: transparent;
@@ -518,17 +486,6 @@
color: currentcolor;
}
}
-
- .discourse-no-touch & {
- &:hover {
- background: transparent;
- color: var(--d-button-transparent-text-color--hover);
-
- .d-icon {
- color: currentcolor;
- }
- }
- }
}
&.btn-primary {
diff --git a/app/assets/stylesheets/desktop/topic-list.scss b/app/assets/stylesheets/desktop/topic-list.scss
index ecc53284333..673c50faea7 100644
--- a/app/assets/stylesheets/desktop/topic-list.scss
+++ b/app/assets/stylesheets/desktop/topic-list.scss
@@ -58,7 +58,6 @@
button.bulk-select {
padding: 0;
- border: 0;
margin-right: var(--space-2);
line-height: var(--line-height-large);
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
index 5eb315a5180..41f1d8d4b4e 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
@@ -44,7 +44,7 @@ import DAutocompleteModifier, {
SKIP,
} from "discourse/modifiers/d-autocomplete";
import { i18n } from "discourse-i18n";
-import Button from "discourse/plugins/chat/discourse/components/chat/composer/button";
+import DButton from "discourse/plugins/chat/discourse/components/chat/composer/button";
import ChatComposerDropdown from "discourse/plugins/chat/discourse/components/chat-composer-dropdown";
import ChatComposerMessageDetails from "discourse/plugins/chat/discourse/components/chat-composer-message-details";
import ChatComposerUploads from "discourse/plugins/chat/discourse/components/chat-composer-uploads";
@@ -758,7 +758,7 @@ export default class ChatComposer extends Component {
{{#if this.inlineButtons.length}}
{{#each this.inlineButtons as |button|}}
- <Button
+ <DButton
@icon={{button.icon}}
class="-{{button.id}}"
disabled={{or this.disabled button.disabled}}
@@ -780,7 +780,7 @@ export default class ChatComposer extends Component {
/>
{{#if this.site.desktopView}}
- <Button
+ <DButton
@icon="paper-plane"
class="-send"
title={{i18n "chat.composer.send"}}
@@ -794,7 +794,7 @@ export default class ChatComposer extends Component {
{{/if}}
</div>
{{#if this.site.mobileView}}
- <Button
+ <DButton
@icon="paper-plane"
class="-send"
title={{i18n "chat.composer.send"}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs
index f7e70e93a31..871cb6442b9 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs
@@ -224,7 +224,7 @@ export default class AiSearchDiscoveries extends Component {
<DButton
@action={{this.continueConversation}}
@label={{this.continueConvoBtnLabel}}
- class="btn-small"
+ class="btn-default btn-small"
>
<AiIndicatorWave @loading={{this.loadingConversationTopic}} />
</DButton>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-tool-list-editor.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-tool-list-editor.gjs
index b122f2c078b..a7a336761ef 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-tool-list-editor.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-tool-list-editor.gjs
@@ -120,7 +120,7 @@ export default class AiToolListEditor extends Component {
<DButton
@translatedLabel={{i18n "discourse_ai.tools.import"}}
@icon="upload"
- class="btn btn-small ai-tool-list-editor__import-button"
+ class="btn btn-default btn-small ai-tool-list-editor__import-button"
@action={{this.importTool}}
/>
<DMenu
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/fast-edit-footer-after/ai-edit-suggestion-button.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/fast-edit-footer-after/ai-edit-suggestion-button.gjs
index 0cb98123e0d..f5388d0ebf3 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/fast-edit-footer-after/ai-edit-suggestion-button.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/fast-edit-footer-after/ai-edit-suggestion-button.gjs
@@ -56,7 +56,7 @@ export default class AiEditSuggestionButton extends Component {
<template>
{{#unless @outletArgs.newValue}}
<DButton
- class="btn-small btn-ai-suggest-edit"
+ class="btn-default btn-small btn-ai-suggest-edit"
@action={{this.suggest}}
@icon="discourse-sparkles"
@label="discourse_ai.ai_helper.fast_edit.suggest_button"
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/index.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/index.gjs
index 6b042da7947..a70f5ddef6f 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/index.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/index.gjs
@@ -254,7 +254,7 @@ export default class DiscoursePostEvent extends Component {
{{#if @onClose}}
<DButton
- class="btn-small discourse-post-event-close"
+ class="btn-default btn-small discourse-post-event-close"
@icon="xmark"
@action={{@onClose}}
/>
diff --git a/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-channel.gjs b/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-channel.gjs
index a5734d64225..798ec5af1a8 100644
--- a/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-channel.gjs
+++ b/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-channel.gjs
@@ -89,7 +89,7 @@ export default class EditChannel extends Component {
<DButton
@action={{@closeModal}}
@label="chat_integration.edit_channel_modal.cancel"
- class="btn-large"
+ class="btn-default btn-large"
/>
</:footer>
</DModal>
diff --git a/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-rule.gjs b/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-rule.gjs
index a754a41eb30..c4accbd5965 100644
--- a/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-rule.gjs
+++ b/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/edit-rule.gjs
@@ -232,7 +232,7 @@ export default class EditRule extends Component {
<DButton
@label="chat_integration.edit_rule_modal.cancel"
@action={{@closeModal}}
- class="btn-large"
+ class="btn-default btn-large"
/>
</:footer>
</DModal>
diff --git a/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/test-integration.gjs b/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/test-integration.gjs
index 5f53326cea5..272c202e265 100644
--- a/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/test-integration.gjs
+++ b/plugins/discourse-chat-integration/admin/assets/javascripts/admin/components/modal/test-integration.gjs
@@ -84,7 +84,7 @@ export default class TestIntegration extends Component {
<DButton
@action={{@closeModal}}
@label="chat_integration.test_modal.close"
- class="btn-large"
+ class="btn-default btn-large"
/>
</ConditionalLoadingSpinner>
</:footer>
diff --git a/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/02-buttons.gjs b/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/02-buttons.gjs
index b8d765d5a91..070e7961992 100644
--- a/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/02-buttons.gjs
+++ b/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/02-buttons.gjs
@@ -3,7 +3,6 @@ import { on } from "@ember/modifier";
import { not } from "truth-helpers";
import DButton from "discourse/components/d-button";
import DToggleSwitch from "discourse/components/d-toggle-switch";
-import FlatButton from "discourse/components/flat-button";
import concatClass from "discourse/helpers/concat-class";
import StyleguideExample from "discourse/plugins/styleguide/discourse/components/styleguide-example";
@@ -14,7 +13,7 @@ const Buttons = <template>
@icon="xmark"
@translatedTitle={{bs.text}}
@disabled={{bs.disabled}}
- class={{bs.class}}
+ class={{concatClass "btn-default" bs.class}}
/>
{{/each}}
</StyleguideExample>
@@ -25,7 +24,7 @@ const Buttons = <template>
@icon="xmark"
@translatedTitle={{bs.text}}
@disabled={{bs.disabled}}
- class={{bs.class}}
+ class={{concatClass "btn-default" bs.class}}
/>
{{/each}}
</StyleguideExample>
@@ -35,7 +34,7 @@ const Buttons = <template>
<DButton
@translatedLabel={{bs.text}}
@disabled={{bs.disabled}}
- class={{bs.class}}
+ class={{concatClass "btn-default" bs.class}}
/>
{{/each}}
</StyleguideExample>
@@ -45,7 +44,7 @@ const Buttons = <template>
<DButton
@translatedLabel={{bs.text}}
@disabled={{bs.disabled}}
- class={{bs.class}}
+ class={{concatClass "btn-default" bs.class}}
/>
{{/each}}
</StyleguideExample>
@@ -58,7 +57,7 @@ const Buttons = <template>
@icon="plus"
@translatedLabel={{bs.text}}
@disabled={{bs.disabled}}
- class={{bs.class}}
+ class={{concatClass "btn-default" bs.class}}
/>
{{/each}}
</StyleguideExample>
@@ -69,7 +68,7 @@ const Buttons = <template>
@icon="plus"
@translatedLabel={{bs.text}}
@disabled={{bs.disabled}}
- class={{bs.class}}
+ class={{concatClass "btn-default" bs.class}}
/>
{{/each}}
</StyleguideExample>
@@ -124,42 +123,45 @@ const Buttons = <template>
<StyleguideExample @title=".btn-flat - sizes (large, default, small)">
{{#each @dummy.buttonSizes as |bs|}}
- <FlatButton
+ <DButton
@icon="trash-can"
@disabled={{bs.disabled}}
@translatedTitle={{bs.title}}
+ class={{concatClass "btn-flat" bs.class}}
/>
{{/each}}
</StyleguideExample>
- <StyleguideExample @title=".btn-flat - states">
+ <StyleguideExample @title="btn-flat - states">
{{#each @dummy.buttonStates as |bs|}}
- <FlatButton
+ <DButton
@icon="trash-can"
@disabled={{bs.disabled}}
- @translatedTitle={{bs.title}}
+ @translatedLabel={{bs.text}}
+ class={{concatClass "btn-flat" bs.class}}
/>
{{/each}}
</StyleguideExample>
- <StyleguideExample
- @title="<DButton> btn-flat btn-text - sizes (large, default, small)"
- >
- {{#each @dummy.buttonSizes as |bs|}}
+ <StyleguideExample @title="btn-transparent - states">
+ {{#each @dummy.buttonStates as |bs|}}
<DButton
+ @icon="trash-can"
@disabled={{bs.disabled}}
@translatedLabel={{bs.text}}
- class={{concatClass "btn-flat" bs.class}}
+ class={{concatClass "btn-transparent" bs.class}}
/>
{{/each}}
</StyleguideExample>
- <StyleguideExample @title="<DButton> btn-flat btn-text - states">
+ <StyleguideExample @title="Button link">
{{#each @dummy.buttonStates as |bs|}}
<DButton
- @disabled={{bs.disabled}}
+ @icon="trash-can"
@translatedLabel={{bs.text}}
- class={{concatClass "btn-flat" bs.class}}
+ @display="link"
+ class={{bs.class}}
+ @disabled={{bs.disabled}}
/>
{{/each}}
</StyleguideExample>
diff --git a/plugins/styleguide/assets/javascripts/discourse/lib/dummy-data.js b/plugins/styleguide/assets/javascripts/discourse/lib/dummy-data.js
index cb59a657f6c..244fc57416e 100644
--- a/plugins/styleguide/assets/javascripts/discourse/lib/dummy-data.js
+++ b/plugins/styleguide/assets/javascripts/discourse/lib/dummy-data.js
@@ -351,13 +351,13 @@ export function createData(store) {
buttonSizes: [
{ class: "btn-large", text: "large" },
- { class: "btn-default", text: "default" },
+ { class: "", text: "default" },
{ class: "btn-small", text: "small" },
],
buttonStates: [
+ { class: "", text: "normal" },
{ class: "btn-hover", text: "hover" },
- { class: "btn-active", text: "active" },
{ disabled: true, text: "disabled" },
],