shelving
Version:
Toolkit for using data in JavaScript.
14 lines (13 loc) • 1 kB
JavaScript
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { walkElements } from "../../util/element.js";
import { Heading } from "../block/Heading.js";
import { Prose } from "../block/Prose.js";
import { Title } from "../block/Title.js";
import { Markup } from "../misc/Markup.js";
import { Page } from "../page/Page.js";
import { TreeCards } from "../tree/TreeCards.js";
/** Page renderer for a `tree-directory` element — shows title, content, and child cards. */
export function DirectoryPage({ path, title, name, description, content, children }) {
const cards = Array.from(walkElements(children));
return (_jsxs(Page, { title: title ?? name, description: description, children: [_jsx(Title, { children: title ?? name }), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) })), cards.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Heading, { children: "Modules" }), _jsx(TreeCards, { path: path, children: cards })] }))] }));
}