From 794e8ed869b74f81a1528e9c26104a28a6dce5a2 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Tue, 15 Jun 2021 15:43:01 +0300 Subject: [PATCH] Showing category icons Signed-off-by: Alex Andreev --- src/renderer/components/+catalog/catalog-menu.tsx | 10 ++++++++++ .../components/+catalog/catalog-tree.module.css | 14 +++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/+catalog/catalog-menu.tsx b/src/renderer/components/+catalog/catalog-menu.tsx index c7c3db0774..72d990cb93 100644 --- a/src/renderer/components/+catalog/catalog-menu.tsx +++ b/src/renderer/components/+catalog/catalog-menu.tsx @@ -28,6 +28,7 @@ import { catalogCategoryRegistry } from "../../api/catalog-category-registry"; import { Icon } from "../icon"; import { StylesProvider } from "@material-ui/core"; import { cssNames } from "../../utils"; +import type { CatalogCategory } from "../../api/catalog-entity"; type Props = { onItemClick: (id: string) => void; @@ -37,6 +38,14 @@ function getCategories() { return catalogCategoryRegistry.items; } +function getCategoryIcon(category: CatalogCategory) { + if (!category.metadata?.icon) return null; + + return category.metadata.icon.includes(" + : ; +} + function Item(props: TreeItemProps) { return ( @@ -63,6 +72,7 @@ export function CatalogMenu(props: Props) { { getCategories().map(category => ( *:first-child { background-color: var(--blue); color: var(--textColorAccent); + border-radius: 2px; } .iconContainer {