/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import treeStyles from "./catalog-tree.module.scss"; import styles from "./catalog-menu.module.scss"; import React from "react"; import { TreeItem, TreeItemProps, TreeView } from "@material-ui/lab"; 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"; import { observer } from "mobx-react"; export interface CatalogMenuProps { activeItem: string; onItemClick: (id: string) => void; } function getCategories() { return catalogCategoryRegistry.filteredItems; } function getCategoryIcon(category: CatalogCategory) { const { icon } = category.metadata ?? {}; if (typeof icon === "string") { return Icon.isSvg(icon) ? : ; } return null; } function Item(props: TreeItemProps) { return ( ); } export const CatalogMenu = observer((props: CatalogMenuProps) => { return ( // Overwrite Material UI styles with injectFirst https://material-ui.com/guides/interoperability/#controlling-priority-4
Catalog
} defaultExpandIcon={} selected={props.activeItem || "browse"} > props.onItemClick("*")}/> Categories
} className={cssNames(styles.bordered)} > { getCategories().map(category => ( props.onItemClick(category.getId())} /> )) }
); });