MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Toc

Function Toc

packages/dev/s2-docs/src/OptimisticToc.tsx:25–40  ·  view source on GitHub ↗
({toc, isNested = false}: {toc: TocNode[]; isNested?: boolean})

Source from the content-addressed store, hash-verified

23});
24
25function Toc({toc, isNested = false}: {toc: TocNode[]; isNested?: boolean}) {
26 return (
27 <OnPageNav>
28 <SideNav isNested={isNested}>
29 {toc.map((c, i) => (
30 <SideNavItem key={i}>
31 <SideNavLink href={'#' + anchorId(c.title)} title={c.title}>
32 <span className={tocLinkTextStyle}>{c.title}</span>
33 </SideNavLink>
34 {c.children.length > 0 && <Toc toc={c.children} isNested />}
35 </SideNavItem>
36 ))}
37 </SideNav>
38 </OnPageNav>
39 );
40}
41
42function renderMobileToc(toc: TocNode[], seen = new Map()) {
43 return toc.map(c => {

Callers

nothing calls this directly

Calls 1

anchorIdFunction · 0.70

Tested by

no test coverage detected