A platform for community discussion. Free, open, simple.
UX: improve back button styles, add optional models (#37588)
Krisd779aeb37b6e
diff --git a/app/assets/stylesheets/common/components/buttons.scss b/app/assets/stylesheets/common/components/buttons.scssindex 2212ab0706b..8e5dee77f8a 100644--- a/app/assets/stylesheets/common/components/buttons.scss+++ b/app/assets/stylesheets/common/components/buttons.scss@@ -470,10 +470,6 @@color: var(--primary);}}-- &.back-button {- margin-bottom: 1em;- }}@mixin btn-colors($btn-type) {@@ -538,6 +534,13 @@&.--success {@include btn-colors("success");}++ &.back-button {+ --d-button-transparent-text-color: var(--tertiary);+ --d-button-transparent-icon-color: var(--tertiary);+ margin-bottom: 1em;+ padding-left: 0;+ }}.btn-mini-toggle {diff --git a/frontend/discourse/admin/templates/edit-category/tabs-horizontal.gjs b/frontend/discourse/admin/templates/edit-category/tabs-horizontal.gjsindex 8c7190dc831..6f0fa779dbc 100644--- a/frontend/discourse/admin/templates/edit-category/tabs-horizontal.gjs+++ b/frontend/discourse/admin/templates/edit-category/tabs-horizontal.gjs@@ -1,27 +1,26 @@import { concat } from "@ember/helper";import { on } from "@ember/modifier";import EditCategoryTab from "discourse/admin/components/edit-category-tab";+import BackButton from "discourse/components/back-button";import BreadCrumbs from "discourse/components/bread-crumbs";-import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";import DPageHeader from "discourse/components/d-page-header";import DToggleSwitch from "discourse/components/d-toggle-switch";import { and } from "discourse/truth-helpers";-import { i18n } from "discourse-i18n";const EditCategoryTabsHorizontalTemplate = <template>+ {{#if (and @controller.site.desktopView @controller.model.id)}}+ <BackButton+ @route="discovery.category"+ @model={{concat @controller.parentParams.slug "/" @controller.model.id}}+ @label="category.back"+ />+ {{/if}}<DPageHeader@titleLabel={{@controller.baseTitle}}@showDrawer={{true}}@collapseActionsOnMobile={{false}}>- <:breadcrumbs>- {{#if (and @controller.site.desktopView @controller.model.id)}}- <DBreadcrumbsItem- @path={{concat "/c/" @controller.model.slug}}- @label={{i18n "category.back"}}- />- {{/if}}- </:breadcrumbs>+<:actions><DToggleSwitch@label="category.show_advanced"diff --git a/frontend/discourse/app/components/back-button.gjs b/frontend/discourse/app/components/back-button.gjsindex bf90c3936fb..0036878a61c 100644--- a/frontend/discourse/app/components/back-button.gjs+++ b/frontend/discourse/app/components/back-button.gjs@@ -1,10 +1,15 @@+import { array } from "@ember/helper";import { LinkTo } from "@ember/routing";import icon from "discourse/helpers/d-icon";import { or } from "discourse/truth-helpers";import { i18n } from "discourse-i18n";<template>- <LinkTo class="btn btn-flat back-button" @route={{@route}}>+ <LinkTo+ class="btn btn-transparent back-button"+ @route={{@route}}+ @models={{if @model (array @model) (array)}}+ >{{icon "chevron-left"}}{{i18n (or @label "back_button")}}</LinkTo>