UNPKG

nice-ui

Version:

React design system, components, and utilities

25 lines (24 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const Menu_1 = require("../../4-card/Menu"); const Space_1 = require("../../3-list-item/Space"); const constants_1 = require("../../constants"); const pageToItem = (page, path) => { return { key: page.to || page.id || page.title || '', menuItem: page.name, to: page.to, active: path === page.to, activeChild: path === page.to || path.startsWith(page.to + '/'), children: page.children ? page.children.map((item) => pageToItem(item, path)) : undefined, onMouseDown: page.md ? () => page.md().catch(() => { }) : undefined, }; }; const DocsMenu = ({ steps, page }) => { const path = steps ? page.to + '/' + steps.slice(1).join('/') : ''; return (React.createElement("div", { style: { width: constants_1.NiceUiSizes.SidebarWidth } }, React.createElement(Space_1.Space, null), React.createElement(Menu_1.Menu, { items: [pageToItem(page, path)] }))); }; exports.default = DocsMenu;