1
0
Fork 0

fix(shared): Apply sitenav filters to ReadMore MDX component

A while ago, I rewrote the sitenav component to *just* use the ReadMore
MDX component to generate the navigation tree.

However, sitenav have certain keys that you can set to control the
visibility of hte item to the user, and those filters were not added
to the ReadMore component, thus showing navigation items that should
have been hidden.
This commit is contained in:
joostdecock 2024-04-27 16:43:59 +02:00
parent 248a52d360
commit 5ce91673b7

View file

@ -26,9 +26,10 @@ const onActivePath = (slug, active) => (active ? active.slice(0, slug.length) ==
* This is a recursive function, so it needs to be lean
*/
const RenderTree = ({ tree, recurse, depth = 1, level = 0, active = false }) => {
const orderedTree = orderBy(tree, ['o', 't'], ['asc', 'asc']).filter(
(item) => typeof item === 'object'
)
const orderedTree = orderBy(tree, ['o', 't'], ['asc', 'asc'])
.filter((item) => typeof item === 'object')
.filter((item) => !item.h)
.filter((item) => !item._)
return (
<ul className="w-full list">