/** * 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 type { TreeItemProps } from "@material-ui/lab"; import { TreeItem, 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"; import { CatalogCategoryLabel } from "./catalog-category-label"; export interface CatalogMenuProps { activeTab: string | undefined; 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.activeTab || "browse"} > props.onItemClick("*")} /> Categories
} className={cssNames(styles.bordered)} > { getCategories().map(category => ( } data-testid={`${category.getId()}-tab`} onClick={() => props.onItemClick(category.getId())} /> )) }
); });