From 5990842dd9b9d3855a38c39996008f8b72aa35d0 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 18 Aug 2022 15:03:28 +0800 Subject: [PATCH] UX: Revamp styling of sidebar The following changes are made in this commit: 1. Move caret icon in sidebar section header to the right. 1. Each row in sidebar takes the full width which enables us to do a full width highlight on hover and when sidebar link is active. 1. Ensure each row in Sidebar is of the same height. Internal refs: /t/70546, /t/72196, /t/71820 --- .../components/sidebar/categories-section.hbs | 2 - .../components/sidebar/community-section.hbs | 3 - .../components/sidebar/messages-section.hbs | 3 - .../components/sidebar/more-section-links.hbs | 26 ++++--- .../app/components/sidebar/section-header.hbs | 14 ++++ .../app/components/sidebar/section-header.js | 3 + .../app/components/sidebar/section-link.hbs | 30 ++++---- .../app/components/sidebar/section-link.js | 1 + .../components/sidebar/section-message.hbs | 2 +- .../app/components/sidebar/section.hbs | 43 +++-------- .../app/components/sidebar/sections.hbs | 1 - .../app/components/sidebar/tags-section.hbs | 2 - .../sidebar/base-custom-sidebar-section.js | 12 --- .../sidebar-categories-section-test.js | 9 +-- .../sidebar-community-section-test.js | 40 ++-------- .../sidebar-messages-section-test.js | 9 +-- .../tests/acceptance/sidebar-mobile-test.js | 2 +- .../acceptance/sidebar-plugin-api-test.js | 27 +------ .../acceptance/sidebar-tags-section-test.js | 11 --- .../components/sidebar/section-link-test.js | 4 +- .../base/sidebar-more-section-links.scss | 37 +++++----- .../common/base/sidebar-section-link.scss | 27 ++----- .../common/base/sidebar-section.scss | 73 +++++-------------- .../stylesheets/common/base/sidebar.scss | 36 +++++---- .../stylesheets/desktop/menu-panel.scss | 8 ++ app/assets/stylesheets/mobile/menu-panel.scss | 12 +++ app/assets/stylesheets/mobile/sidebar.scss | 3 +- config/locales/client.en.yml | 4 - 28 files changed, 166 insertions(+), 278 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs create mode 100644 app/assets/javascripts/discourse/app/components/sidebar/section-header.js diff --git a/app/assets/javascripts/discourse/app/components/sidebar/categories-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/categories-section.hbs index 5da3adc761f..4eb10dc30e6 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/categories-section.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/categories-section.hbs @@ -1,8 +1,6 @@ diff --git a/app/assets/javascripts/discourse/app/components/sidebar/community-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/community-section.hbs index 94696fa6487..f709e645313 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/community-section.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/community-section.hbs @@ -1,9 +1,6 @@ diff --git a/app/assets/javascripts/discourse/app/components/sidebar/messages-section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/messages-section.hbs index e27bb15a612..35d77d15f93 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/messages-section.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/messages-section.hbs @@ -1,12 +1,9 @@ {{#each this.personalMessagesSectionLinks as |personalMessageSectionLink|}} diff --git a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs index 41d3ef7fdbb..0eb84ca6323 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs @@ -3,28 +3,30 @@ {{/if}} diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs b/app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs new file mode 100644 index 00000000000..37103bf04c9 --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/sidebar/section-header.hbs @@ -0,0 +1,14 @@ +{{#if @collapsable}} + + {{yield}} + +{{else}} + + {{yield}} + +{{/if}} diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section-header.js b/app/assets/javascripts/discourse/app/components/sidebar/section-header.js new file mode 100644 index 00000000000..742bb3c18ef --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/sidebar/section-header.js @@ -0,0 +1,3 @@ +import templateOnly from "@ember/component/template-only"; + +export default templateOnly(); diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs b/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs index e6dfc90c2e1..d1978f91641 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/section-link.hbs @@ -51,21 +51,21 @@ {{/if}} {{/if}} - - {{#if @hoverValue}} - - - - {{/if}} + {{#if @hoverValue}} + + + + {{/if}} + {{/if}} diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section-link.js b/app/assets/javascripts/discourse/app/components/sidebar/section-link.js index d8badbf436a..16385ec1f9c 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/section-link.js +++ b/app/assets/javascripts/discourse/app/components/sidebar/section-link.js @@ -12,6 +12,7 @@ export default class SectionLink extends Component { let classNames = [ "sidebar-section-link", `sidebar-section-link-${this.args.linkName}`, + "sidebar-row", ]; if (this.args.class) { diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section-message.hbs b/app/assets/javascripts/discourse/app/components/sidebar/section-message.hbs index d3d92dad946..cb81be10536 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/section-message.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/section-message.hbs @@ -1,4 +1,4 @@ -