How to use the @mui-treasury/utils.useNestedMenuList function in @mui-treasury/utils

To help you get started, we’ve selected a few @mui-treasury/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github siriwatknp / mui-treasury / packages / mui-components / src / menuList / NestedMenuList / NestedMenuList.js View on Github external
menus,
      selectedKey,
      openKeys,
      menuComponent,
      ListProps,
      CollapseProps,
      getItemProps,
      getConfig,
      onClick,
    } = props;
    const keyMap = useMemo(() => mapNestedPath(menus), [menus]);
    const {
      injectParentProps,
      injectItemProps,
      injectListProps,
    } = useNestedMenuList(selectedKey, openKeys);
    const renderMenus = (level, keyPath) => item => {
      const { key, label, subMenus, ...itemProps } = item;
      const params = {
        ...getConfig(level),
        ...item,
        onClick,
        classes: css,
        level,
        keyMap,
        keyPath,
      };
      const calculatedProps = injectItemProps(params);
      const nextLevel = level + 1;
      const menu = (