shelving
Version:
Toolkit for using data in JavaScript.
18 lines (17 loc) • 1.09 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { App } from "../app/App.js";
import { SidebarLayout } from "../layout/SidebarLayout.js";
import { PageCatcher } from "../misc/Catcher.js";
import { TreeRouter } from "./TreeRouter.js";
import { TreeSidebar } from "./TreeSidebar.js";
/**
* Top-level app component for a tree-based documentation site.
* - Wraps `<App>` with error catching and a sidebar layout.
* - The sidebar shows a `<TreeSidebar>` (root as a home link + a menu of its children).
* - `/` renders the root via `<TreePage>`; `/**` catches every deeper path and feeds the full sub-path into `<TreePage>`.
* - Element rendering uses the default mappings on `<TreePage>`, `<TreeMenu>`, `<TreeCards>`.
* Override by wrapping with `<TreePageMapping>`, `<TreeMenuMapping>`, or `<TreeCardMapping>`.
*/
export function TreeApp({ tree, routes: extraRoutes, ...meta }) {
return (_jsx(App, { ...meta, children: _jsx(PageCatcher, { children: _jsx(SidebarLayout, { sidebar: _jsx(TreeSidebar, { tree: tree }), children: _jsx(TreeRouter, { tree: tree }) }) }) }));
}