From b50a581c5d6c9572bfeb843785a3fd9bdba49811 Mon Sep 17 00:00:00 2001 From: chapoi <101828855+chapoi@users.noreply.github.com> Date: Mon, 20 Feb 2023 21:14:54 +0700 Subject: [PATCH] UX: badge page styling update (#20373) * UX: change layout badge card * UX: copy change * UX: badge list styling * UX: make active badge styling more clear * Update translation Co-authored-by: Gerhard Schlager * Include x in translation Co-authored-by: Gerhard Schlager --------- Co-authored-by: Gerhard Schlager --- .../discourse/app/components/badge-card.hbs | 19 ++++++---- .../stylesheets/common/base/discourse.scss | 1 + .../stylesheets/common/base/user-badges.scss | 35 ++++++++----------- config/locales/client.en.yml | 3 ++ 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/badge-card.hbs b/app/assets/javascripts/discourse/app/components/badge-card.hbs index ce72346d19..4a6fe7a13c 100644 --- a/app/assets/javascripts/discourse/app/components/badge-card.hbs +++ b/app/assets/javascripts/discourse/app/components/badge-card.hbs @@ -1,10 +1,3 @@ -{{#if this.displayCount}} - {{this.displayCount}} -{{/if}} {{#if this.badge.has_badge}} {{d-icon "check" @@ -46,6 +39,18 @@

{{this.badge.name}}

{{html-safe this.summary}}
+ + {{#if this.displayCount}} +
+ {{html-safe + (i18n + "badges.granted_with_count" + count=this.displayCount + badgeUrl=this.url + ) + }} +
+ {{/if}}
\ No newline at end of file diff --git a/app/assets/stylesheets/common/base/discourse.scss b/app/assets/stylesheets/common/base/discourse.scss index e875d3accd..0d1e38e3e9 100644 --- a/app/assets/stylesheets/common/base/discourse.scss +++ b/app/assets/stylesheets/common/base/discourse.scss @@ -552,6 +552,7 @@ table { &.active { font-weight: bold; color: var(--primary); + background: var(--d-selected); } } } diff --git a/app/assets/stylesheets/common/base/user-badges.scss b/app/assets/stylesheets/common/base/user-badges.scss index 32886dc0ca..acc9f02631 100644 --- a/app/assets/stylesheets/common/base/user-badges.scss +++ b/app/assets/stylesheets/common/base/user-badges.scss @@ -127,17 +127,23 @@ .check-display { position: absolute; - left: 5px; + right: 5px; top: 5px; } + .badge-granted { + margin-top: 0.5em; + } + .grant-count { - position: absolute; - right: 5px; - top: 5px; font-weight: bold; color: var(--primary-medium); - font-size: var(--font-up-2); + line-height: 1; + } + + .grant-text { + color: var(--primary-medium); + font-size: var(--font-down-1); } .favorite-btn { @@ -145,11 +151,11 @@ right: 0; bottom: 0; } - .badge-contents { display: flex; - min-height: 8em; - padding: 0 1.5em; + align-items: flex-start; + gap: 1rem; + padding: 1.5em 1.5em; .badge-link { color: var(--primary); @@ -158,10 +164,8 @@ .badge-icon { display: flex; flex-shrink: 0; - margin-right: 1.5em; align-items: center; justify-content: center; - width: 64px; svg { font-size: 3.5em; @@ -190,7 +194,6 @@ display: flex; flex: 1 1 auto; align-items: center; - padding: 1em 0; color: var(--primary); h3 { @@ -245,19 +248,11 @@ .badge-group-list { display: grid; - grid: auto-flow / repeat(3, 1fr); + grid-template-columns: repeat(auto-fit, minmax(18em, 1fr)); grid-gap: 1em; width: 100%; margin-bottom: 1.5em; - @include breakpoint(medium) { - grid: auto-flow / repeat(2, 1fr); - } - - @include breakpoint(mobile-extra-large) { - grid: auto-flow / 1fr; - } - .title { font-size: var(--font-up-1); } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index b2c7ed7561..f1c8d8c88b 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -4121,6 +4121,9 @@ en: granted: one: "%{count} granted" other: "%{count} granted" + granted_with_count: + one: '%{count}x granted' + other: '%{count}x granted' select_badge_for_title: Select a badge to use as your title none: "(none)" successfully_granted: "Successfully granted %{badge} to %{username}"