Skip to content

Commit

Permalink
Merge pull request #35 from novalagung/feat/sidebar-enchancement
Browse files Browse the repository at this point in the history
hide the /wip/ paths
  • Loading branch information
novalagung authored Jan 25, 2023
2 parents 8374be2 + fe44834 commit 64660de
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/theme/DocSidebarItems/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, {memo} from 'react';
import {DocSidebarItemsExpandedStateProvider} from '@docusaurus/theme-common/internal';
import DocSidebarItem from '@theme/DocSidebarItem';
// TODO this item should probably not receive the "activePath" props
// TODO this triggers whole sidebar re-renders on navigation
function DocSidebarItems({items, ...props}) {
const itemsFiltered = items.filter((d) => (d.href || '').indexOf('/wip/') === -1)
return (
<DocSidebarItemsExpandedStateProvider>
{itemsFiltered.map((item, index) => (
<DocSidebarItem key={index} item={item} index={index} {...props} />
))}
</DocSidebarItemsExpandedStateProvider>
);
}
// Optimize sidebar at each "level"
export default memo(DocSidebarItems);

0 comments on commit 64660de

Please sign in to comment.