Skip to content

Commit dfe2196

Browse files
committed
fixup!
1 parent f004539 commit dfe2196

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

components/Sidebar/index.jsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import SideBar from '@node-core/ui-components/Containers/Sidebar';
2+
3+
/**
4+
* Redirect to a URL
5+
* @param {string} url URL
6+
*/
7+
const redirect = url => (window.location.href = url);
8+
9+
/**
10+
* Sidebar component for MDX documentation with page navigation
11+
* @param {import('../Layout').Props} props
12+
*/
13+
export default ({ metadata }) => {
14+
const items = pages.map(([heading, path]) => ({
15+
label: heading,
16+
link:
17+
metadata.path === path
18+
? `${metadata.basename}.html`
19+
: `${relative(path, metadata.path)}.html`,
20+
}));
21+
22+
return (
23+
<SideBar
24+
pathname={`${metadata.basename}.html`}
25+
groups={[{ groupName: 'Learn Articles', items }]}
26+
onSelect={redirect}
27+
as={props => <a {...props} rel="prefetch" />}
28+
title="Navigation"
29+
/>
30+
);
31+
};

0 commit comments

Comments
 (0)