Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow four levels of sidebar entries #486

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Jul 17, 2024

Currently, the code that generates the navigation sidebar from a
directory tree stops at the second level of a given top-level section.
However, some sections include three levels of content. This change
edits the sidebar generator so it works recursively.

Also fix an issue with the DocsNavigationItems component that prevents
the docs site from highlighting sidebar entries past two levels of
depth. The component treats a sidebar subsection as "active" if one of
its entries is equivalent to the current page path.

But if the current page path is a grandchild of a sidebar subsection,
this means that the component hides the grandchild, since none of the
children of the subsection is equivalent to the current page. This
change determines that a sidebar subsection is "active" if the selected
path starts with the subsection path.

Also edit the CSS padding of navigation links to depend on the current
level of the navigation menu. This allows for indentation of submenu
links beyond the second level.

@ptgott ptgott requested a review from avatus as a code owner July 17, 2024 17:34
Copy link

vercel bot commented Jul 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2024 3:45pm

@ptgott
Copy link
Contributor Author

ptgott commented Jul 18, 2024

image

@ptgott ptgott marked this pull request as ready for review July 18, 2024 14:29
@ptgott ptgott force-pushed the paul.gottschling/2024-07-gen-sidebar-lvls branch from 735b30c to be80e60 Compare July 18, 2024 14:45
@ptgott ptgott changed the title Generate sidebar entries at an arbitrary depth Allow four levels of sidebar entries Jul 18, 2024
@ptgott ptgott force-pushed the paul.gottschling/2024-07-gen-sidebar-lvls branch from be80e60 to 714532b Compare July 18, 2024 15:28
Currently, the code that generates the navigation sidebar from a
directory tree stops at the second level of a given top-level section.
However, some sections include three levels of content. This change
edits the sidebar generator so it works recursively.

Also fix an issue with the `DocsNavigationItems` component that prevents
the docs site from highlighting sidebar entries past two levels of
depth. The component treats a sidebar subsection as "active" if one of
its entries is equivalent to the current page path.

But if the current page path is a grandchild of a sidebar subsection,
this means that the component hides the grandchild, since none of the
children of the subsection is equivalent to the current page. This
change determines that a sidebar subsection is "active" if the selected
path _starts with_ the subsection path.

Also edit the CSS padding of navigation links to depend on the current
level of the navigation menu. This allows for indentation of submenu
links beyond the second level.
@ptgott ptgott merged commit 9b1b618 into main Jul 19, 2024
9 checks passed
travelton pushed a commit that referenced this pull request Aug 26, 2024
Currently, the code that generates the navigation sidebar from a
directory tree stops at the second level of a given top-level section.
However, some sections include three levels of content. This change
edits the sidebar generator so it works recursively.

Also fix an issue with the `DocsNavigationItems` component that prevents
the docs site from highlighting sidebar entries past two levels of
depth. The component treats a sidebar subsection as "active" if one of
its entries is equivalent to the current page path.

But if the current page path is a grandchild of a sidebar subsection,
this means that the component hides the grandchild, since none of the
children of the subsection is equivalent to the current page. This
change determines that a sidebar subsection is "active" if the selected
path _starts with_ the subsection path.

Also edit the CSS padding of navigation links to depend on the current
level of the navigation menu. This allows for indentation of submenu
links beyond the second level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants