Fix navbar highlight for Organized Content sections #182
Merged
a258wang
merged 10 commits from amy-navbar-highlight-fix
into main
1 year ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'amy-navbar-highlight-fix'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Also fixes the navbar highlight for the different Advice sections.
Closes #181
const isCurrentPage =
router.pathname === props.route ||
(props.submenu != null &&
router.pathname.startsWith(getMainRoute(props.route)));
What if we do:
That doesn't work because whenever we navigate to anything in the About submenu, all of the other entries in the submenu will also be highlighted blue. (Same for the Resources submenu.)
Side note: I ended up keeping the About Us page at
/about
because I was able to make it work, but let me know if we'd prefer to move it to/about/us
. :)submenu?: {
name: string;
route: string;
hasSubsections?: boolean;
We don't need this anymore, correct?
Oops yes sorry, I'll get rid of it! I had to do some mergey stuff and I must've forgotten to delete this line lol
ancestors: { name: string; route: string }[];
}[];
function dfs(
I think this function should be called something like
collectLeaves
Let's make the signature of this function similar to what reduce takes in. Then we could do
(or something like this)
}
let ret = [] as Leaves;
for (const subEntry of entry.submenu) {
ret = ret.concat(dfs(subEntry, [...ancestors, entry]));
You can use
push
ret.push(...dfs(subEntry, [...ancestors, entry]));
Just some nitpicks, looks good otherwise! :)
0bb8049db3
into main 1 year agoReviewers
0bb8049db3
.