Files
med-notes/.pnpm-store/v10/files/57/447fa8954a1687a889ccd0505d4325c82cdc3c8aaa677b74cc923e7ef7d25168bccfbf05c8b240842644b00577135999823eb708a52df80c958f5081419ba0
2025-05-09 05:30:08 +02:00

21 lines
883 B
Plaintext

import { jsx as _jsx } from "react/jsx-runtime";
import { useMemo } from 'react';
import { getAttributes, isStructTreeNode, isStructTreeNodeWithOnlyContentChild, } from './shared/structTreeUtils.js';
export default function StructTreeItem({ className, node, }) {
const attributes = useMemo(() => getAttributes(node), [node]);
const children = useMemo(() => {
if (!isStructTreeNode(node)) {
return null;
}
if (isStructTreeNodeWithOnlyContentChild(node)) {
return null;
}
return node.children.map((child, index) => {
return (
// biome-ignore lint/suspicious/noArrayIndexKey: index is stable here
_jsx(StructTreeItem, { node: child }, index));
});
}, [node]);
return (_jsx("span", Object.assign({ className: className }, attributes, { children: children })));
}