fumadocs-ui
Version:
The Radix UI version of Fumadocs UI
24 lines (23 loc) • 794 B
JavaScript
import { getLayoutTabs } from "../shared/index.js";
import { LayoutBody, useNotebookLayout } from "./client.js";
import { jsx } from "react/jsx-runtime";
import { useMemo } from "react";
//#region src/layouts/notebook/index.tsx
function DocsLayout({ tree, tabMode = "sidebar", sidebar: { tabs: defaultTabs, ...sidebarProps } = {}, children, tabs = defaultTabs, ...props }) {
const resolvedTabs = useMemo(() => {
if (Array.isArray(tabs)) return tabs;
if (typeof tabs === "object") return getLayoutTabs(tree, tabs);
if (tabs !== false) return getLayoutTabs(tree);
return [];
}, [tabs, tree]);
return /* @__PURE__ */ jsx(LayoutBody, {
tree,
tabs: resolvedTabs,
tabMode,
sidebar: sidebarProps,
...props,
children
});
}
//#endregion
export { DocsLayout, useNotebookLayout };