Display subcategory icons in /c/{slug}/{id}/and /categories views. (#6)

See https://meta.discourse.org/t/category-icons-component/104683/50?u=md-misko
This commit is contained in:
md-misko 2020-08-25 19:27:32 +02:00 committed by GitHub
parent f9b432ea79
commit 38781436cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -21,3 +21,7 @@ span.category-badge-icon {
.categories-list .category-box-heading h3 div {
display: inline;
}
.subcategory .category-icon-widget {
display: none;
}

View File

@ -133,7 +133,7 @@ export default {
tagName: "div.category-icon-widget",
html(attrs) {
let iconItem = getIconItem(attrs.category.slug);
if (iconItem && !attrs.category.parent_category_id) {
if (iconItem) {
let itemColor = iconItem[2] ? `color: ${iconItem[2]}` : "";
let itemIcon = iconItem[1] != "" ? iconNode(iconItem[1]) : "";
return h("span.category-icon", { style: itemColor }, itemIcon);