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

Function OptimisticMobileToc

packages/dev/s2-docs/src/OptimisticToc.tsx:147–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145}
146
147export function OptimisticMobileToc() {
148 let {currentPage} = useRouter();
149
150 if ((currentPage.tableOfContents?.[0]?.children?.length ?? 0) <= 1) {
151 return null;
152 }
153
154 let withRelatedPages = currentPage.exports?.relatedPages
155 ? [
156 ...(currentPage.tableOfContents ?? []),
157 {
158 level: 2,
159 title: 'Related pages',
160 children: []
161 }
162 ]
163 : currentPage.tableOfContents!;
164
165 return <MobileOnPageNav>{renderMobileToc(withRelatedPages)}</MobileOnPageNav>;
166}

Callers

nothing calls this directly

Calls 2

useRouterFunction · 0.90
renderMobileTocFunction · 0.85

Tested by

no test coverage detected