({
node,
currentPath,
toggle,
}: {
node: PageTree.Node;
currentPath: string;
toggle?: () => void;
})
| 162 | ); |
| 163 | |
| 164 | const RootSection = ({ |
| 165 | node, |
| 166 | currentPath, |
| 167 | toggle, |
| 168 | }: { |
| 169 | node: PageTree.Node; |
| 170 | currentPath: string; |
| 171 | toggle?: () => void; |
| 172 | }) => { |
| 173 | switch (node.type) { |
| 174 | case 'page': |
| 175 | return ( |
| 176 | <PageLink |
| 177 | node={node} |
| 178 | className={classes.rootSection} |
| 179 | active={currentPath === node.url} |
| 180 | iconClassName={classes.rootSectionIcon} |
| 181 | toggle={toggle} |
| 182 | /> |
| 183 | ); |
| 184 | case 'folder': { |
| 185 | const url = firstInternalPageUrl(node); |
| 186 | if (!url) return null; |
| 187 | |
| 188 | const active = containsCurrentPage(node, currentPath); |
| 189 | |
| 190 | return ( |
| 191 | <Link |
| 192 | className={classes.rootSection} |
| 193 | to={url} |
| 194 | prefetch="render" |
| 195 | data-active={active} |
| 196 | aria-current={active ? 'location' : undefined} |
| 197 | onClick={toggle} |
| 198 | > |
| 199 | <span>{node.name}</span> |
| 200 | </Link> |
| 201 | ); |
| 202 | } |
| 203 | default: |
| 204 | return null; |
| 205 | } |
| 206 | }; |
| 207 | |
| 208 | const LeftSidebar = ({ tree, toggle }: LeftSidebarProps) => { |
| 209 | const pageTree = usePageTree(tree); |
nothing calls this directly
no test coverage detected