()
| 60 | } |
| 61 | |
| 62 | export function OptimisticToc() { |
| 63 | let {currentPage} = useRouter(); |
| 64 | let section = currentPage.exports?.section; |
| 65 | let hasToC = |
| 66 | (!currentPage.exports?.hideNav || section === 'Blog' || section === 'Releases') && |
| 67 | currentPage.tableOfContents?.[0]?.children && |
| 68 | currentPage.tableOfContents?.[0]?.children?.length > 0; |
| 69 | if (!hasToC) { |
| 70 | return null; |
| 71 | } |
| 72 | |
| 73 | return ( |
| 74 | <aside |
| 75 | className={style({ |
| 76 | position: 'sticky', |
| 77 | top: 0, |
| 78 | paddingTop: 32, |
| 79 | marginBottom: -40, |
| 80 | boxSizing: 'border-box', |
| 81 | width: 180, |
| 82 | flexShrink: 0, |
| 83 | display: { |
| 84 | default: 'none', |
| 85 | lg: 'flex' |
| 86 | }, |
| 87 | flexDirection: 'column' |
| 88 | })}> |
| 89 | <div |
| 90 | className={style({ |
| 91 | font: 'title', |
| 92 | minHeight: 32, |
| 93 | paddingX: 12, |
| 94 | display: 'flex', |
| 95 | alignItems: 'center', |
| 96 | marginBottom: 4, |
| 97 | flexShrink: 0 |
| 98 | })}> |
| 99 | On this page |
| 100 | </div> |
| 101 | <ScrollableToc> |
| 102 | <Toc toc={currentPage.tableOfContents?.[0]?.children ?? []} key={currentPage.url} /> |
| 103 | {currentPage.exports?.relatedPages && ( |
| 104 | <RelatedPages pages={currentPage.exports.relatedPages} /> |
| 105 | )} |
| 106 | </ScrollableToc> |
| 107 | <div className={style({flexShrink: 0})}> |
| 108 | <Divider size="S" styles={style({marginY: 12})} /> |
| 109 | <MarkdownMenu name={currentPage.name} url={currentPage.url} /> |
| 110 | </div> |
| 111 | </aside> |
| 112 | ); |
| 113 | } |
| 114 | |
| 115 | function isExternalUrl(url: string): boolean { |
| 116 | return url.startsWith('http://') || url.startsWith('https://'); |
nothing calls this directly
no test coverage detected