fixed active state of sub navigation items, which are using activeWhenMatch

This commit is contained in:
Sebastian Sdorra
2020-06-17 14:49:54 +02:00
committed by René Pfeuffer
parent 91aca71591
commit dcac6b3f22
6 changed files with 143 additions and 18 deletions

View File

@@ -86,4 +86,18 @@ storiesOf("Navigation|Secondary", module)
</SecondaryNavigation>
</BinderContext.Provider>
);
});
})
.add("Active when match", () =>
withRoute("/hog")(
<SecondaryNavigation label="Hitchhiker">
<SecondaryNavigationItem to="/42" icon="fas fa-puzzle-piece" label="Puzzle 42" title="Puzzle 42" />
<SecondaryNavigationItem
activeWhenMatch={route => route.location.pathname === "/hog"}
to="/heart-of-gold"
icon="fas fa-star"
label="Heart Of Gold"
title="Heart Of Gold"
/>
</SecondaryNavigation>
)
);