Skip to content

Commit 64660de

Browse files
authored
Merge pull request #35 from novalagung/feat/sidebar-enchancement
hide the /wip/ paths
2 parents 8374be2 + fe44834 commit 64660de

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/theme/DocSidebarItems/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, {memo} from 'react';
2+
import {DocSidebarItemsExpandedStateProvider} from '@docusaurus/theme-common/internal';
3+
import DocSidebarItem from '@theme/DocSidebarItem';
4+
// TODO this item should probably not receive the "activePath" props
5+
// TODO this triggers whole sidebar re-renders on navigation
6+
function DocSidebarItems({items, ...props}) {
7+
const itemsFiltered = items.filter((d) => (d.href || '').indexOf('/wip/') === -1)
8+
return (
9+
<DocSidebarItemsExpandedStateProvider>
10+
{itemsFiltered.map((item, index) => (
11+
<DocSidebarItem key={index} item={item} index={index} {...props} />
12+
))}
13+
</DocSidebarItemsExpandedStateProvider>
14+
);
15+
}
16+
// Optimize sidebar at each "level"
17+
export default memo(DocSidebarItems);

0 commit comments

Comments
 (0)