From cae60b5900eb8be6b3ee6b686cbcb3cccc5aadbb Mon Sep 17 00:00:00 2001 From: Kris Date: Tue, 7 Jan 2020 16:38:17 -0500 Subject: [PATCH] UX: Sub-sub categories in "Boxes with subcategories" + consistency --- .../templates/components/categories-boxes.hbs | 27 ++++++++-- .../common/base/category-list.scss | 53 +++++++++++++++++-- 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs b/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs index 8ae095c267..cd47c93cf0 100644 --- a/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs +++ b/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs @@ -26,8 +26,27 @@
{{{text-overflow class="overflow" text=c.description_excerpt}}}
- - {{#if c.subcategories}} + {{#if c.isGrandParent}} + {{#each c.subcategories as |subcategory|}} +
+
+ {{category-title-link tagName="h4" category=subcategory}} + {{#if subcategory.subcategories}} +
+ {{#each subcategory.subcategories as |subsubcategory|}} + {{#unless subsubcategory.isMuted}} + + {{category-title-before category=subsubcategory}} + {{category-link subsubcategory hideParent="true"}} + + {{/unless}} + {{/each}} +
+ {{/if}} +
+
+ {{/each}} + {{else if c.subcategories}}
{{#each c.subcategories as |sc|}} @@ -38,7 +57,7 @@ width=sc.uploaded_logo.width height=sc.uploaded_logo.height}} - {{sc.name}} + {{category-link sc hideParent="true"}} {{/each}}
@@ -46,4 +65,4 @@ -{{/each}} \ No newline at end of file +{{/each}} diff --git a/app/assets/stylesheets/common/base/category-list.scss b/app/assets/stylesheets/common/base/category-list.scss index ae1b117c0d..9ea88b6348 100644 --- a/app/assets/stylesheets/common/base/category-list.scss +++ b/app/assets/stylesheets/common/base/category-list.scss @@ -57,6 +57,7 @@ @supports (--custom: property) { .logo.aspect-image img { --height: 40px; + height: var(--height); width: calc(var(--height) * var(--aspect-ratio)); max-width: 100%; } @@ -128,6 +129,46 @@ overflow: hidden; } + h4 a { + color: $primary; + } + + .subcategory.with-subcategories { + border: none; + border-left-width: 4px; + border-left-style: solid; + margin-bottom: 0.25em; + + .category-title-link { + display: flex; + .category-logo { + flex: 1 0 auto; + margin: 0.25em 0.5em 0.5em 0; + --max-height: 40px; + } + .category-text-title { + order: 2; + line-height: $line-height-medium; + overflow: hidden; + word-wrap: break-word; + } + } + + .subcategory-box-inner { + border: 1px solid $primary-low; + border-left: none; + padding: 0.75em 0.5em 0.4em 0.5em; + } + + &:not(:last-of-type) { + margin-bottom: 1em; + } + + .subcategory { + margin-bottom: 0.25em; + } + } + .subcategories { display: flex; flex-flow: wrap; @@ -135,11 +176,14 @@ display: flex; align-items: center; @include ellipsis; - margin-right: 1em; margin-bottom: 0.6em; + .badge-wrapper { + overflow: hidden; + } .subcategory-image-placeholder { display: inline-block; margin-right: 0.6em; + flex: 1 0 auto; } .subcategory-link { min-width: 0; @@ -147,8 +191,9 @@ } .logo img { display: inline-block; - height: 20px; - width: 20px; + --height: 20px; + height: var(--height); + width: calc(var(--height) * var(--aspect-ratio)); margin: 0; } } @@ -210,7 +255,7 @@ height: 0.76em; width: 0.76em; vertical-align: baseline; - margin-right: 0.15em; + margin-right: 0.1em; } } .category-description {