mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 22:11:55 +00:00
* fix(docs): added margin between sections * feat: removed unused files; updated ga * fix: juan stuff doesnt work * fix: random fix * moon at noon * fix: update docusaurus config * Update controller_doc_classes.py * fix: temp fix * fix: temp fix * Update controller_doc_classes.py * fix: remove old content * fix: taggfix * init * fix: styling and moved file * Update generate_terminal_markdown.py * fix: removed unused images * fix: port new files * Update generate_sdk_markdown.py * Update controller_doc_classes.py Co-authored-by: teh_coderer <me@tehcoderer.com>
41 lines
1.2 KiB
JavaScript
Vendored
41 lines
1.2 KiB
JavaScript
Vendored
import clsx from "clsx";
|
|
import React from "react";
|
|
// Recursive component rendering the toc tree
|
|
function TOCItemTree({ toc, className, linkClassName, isChild }) {
|
|
if (!toc.length) {
|
|
return null;
|
|
}
|
|
return (
|
|
<ul
|
|
className={
|
|
isChild ? "list-none ml-1 border-l border-grey-300 dark:border-grey-600 mt-2" : "border-l border-grey-300 dark:border-grey-600 list-none pl-4" /*className*/
|
|
}
|
|
>
|
|
{toc.map((heading, idx) => (
|
|
<li key={heading.id} className={clsx({
|
|
"pb-1": idx === 0,
|
|
"py-1": idx !== 0,
|
|
"pl-3": isChild
|
|
})}>
|
|
{/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
|
|
<a
|
|
href={`#${heading.id}`}
|
|
className={linkClassName ?? undefined}
|
|
// Developer provided the HTML, so assume it's safe.
|
|
// eslint-disable-next-line react/no-danger
|
|
dangerouslySetInnerHTML={{ __html: heading.value }}
|
|
/>
|
|
<TOCItemTree
|
|
isChild
|
|
toc={heading.children}
|
|
className={className}
|
|
linkClassName={linkClassName}
|
|
/>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
);
|
|
}
|
|
// Memo only the tree root is enough
|
|
export default React.memo(TOCItemTree);
|