Skip to content

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

UX: Truncate long category names in sidebar (#17203)

Alan Guo Xiang Tan7b2ad1b9313d
diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs
index 3faa0becac1..747286ac08a 100644
--- a/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs
@@ -7,7 +7,9 @@
@current-when={{@currentWhen}}
@title={{@title}}
>
- {{@content}}
+ <span class="sidebar-section-link-content-text">
+ {{@content}}
+ </span>
{{#if @badgeText}}
<span class="sidebar-section-link-content-badge">
diff --git a/app/assets/stylesheets/common/base/sidebar.scss b/app/assets/stylesheets/common/base/sidebar.scss
index 27b0ceb84e4..1158a7eb0ed 100644
--- a/app/assets/stylesheets/common/base/sidebar.scss
+++ b/app/assets/stylesheets/common/base/sidebar.scss
@@ -84,13 +84,11 @@
.sidebar-section-link-wrapper {
margin-left: 1.5em;
- display: flex;
- align-items: center;
}
.sidebar-section-link {
- flex: 1 1 0;
display: flex;
+ align-items: center;
padding: 0.25em 0.5em;
color: var(--primary-high);
font-size: var(--font-down-1);
@@ -104,8 +102,24 @@
font-weight: bold;
}
- .badge-wrapper {
- font-size: 100%;
+ .sidebar-section-link-content-badge {
+ width: 30%;
+ text-align: right;
+ }
+
+ .sidebar-section-link-content-text {
+ width: 70%;
+
+ .badge-wrapper {
+ font-size: 100%;
+ width: 100%;
+
+ .category-name {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ }
}
}