'use client'; import Link from 'next/link.js'; import { useState } from 'react'; import { useSectionContext } from '../context/section'; import { useThemeContext } from '../context/theme'; import { Doc, DocsStructure } from '../types/types'; import { toKebabCase } from '../utils/stringUtils'; import styles from './SideBar.module.css'; function TreeNode({ doc }: { doc: Doc }) { const [isExpanded, setIsExpanded] = useState(true); const { section, setSection } = useSectionContext(); const docTitleId = toKebabCase(doc.title); const isActiveSection = docTitleId === section; const linkStyle = isActiveSection ? styles.activeLink : styles.link; const hasChildren = doc.children && doc.children?.length > 0; return (
  • {hasChildren ? (
    {doc.copy ? ( setSection(docTitleId)} href={`#${docTitleId}`} className={linkStyle} > {doc.title} ) : (
    {doc.title}
    )}
    setIsExpanded(!isExpanded)} > {isExpanded ? ( ) : ( )}
    ) : doc.copy ? ( setSection(docTitleId)} href={`#${docTitleId}`} className={linkStyle} > {doc.title} ) : (
    {doc.title}
    )} {doc.children && doc.children?.length > 0 && isExpanded && }
  • ); } function ListTree({ docs }: { docs: Doc[] }) { return ( ); } export default function SideBar({ versionDocStructure, }: { versionDocStructure: DocsStructure; }) { const { theme, setTheme } = useThemeContext(); return (

    Onspring {' '} API

    ); }