-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat: add option sideNavLayout
#2633
base: main
Are you sure you want to change the base?
Conversation
Add support for theme option `sideNavLayout`. If set to `factored`, the side-nav menu will group items that share a common path prefix. For example, if the default layout for side-nav looked like this: /config > /config/alert > /config/bacnet > /config/modbus > /log > Then the factored side-nav would look like this: /config > /log > and after expanding /config, you'd see: /config v GET /config PUT /config …/alert > …/bacnet > …/modbus > /log > Note that this commit also updates the styling to show a vertical line to the left of all side-bar <ul> lists that are not at the root level. This probably should be configurable.
It should be possible to collapse a parent item regardless of whether or not it is the currently active item. Prior to this fix, clicking on a parent item's "fold" icon was ignored unless the item was the currently active one. With this fix, the parent node and its children will be collapsed, as expected.
At the end of the loop, we need to append the remaining new children, if there are any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dmosberger, Thank you for your contribution.
Our navbar is built from tags
and x-tagGroups
. You can put the exact tag to each operation, and it works as you expected. If you want to do that programmatically you can use @redocly/cli
and create a custom plugin to make changes. Here is an example of how to create a custom plugin.
I believe this way is more clear instead of adding a new maintainable option.
Alex, thanks for your response. It's entirely possible I'm missing something, but when I read the description here, it left me with the understanding that
Also, it appears that tag groups are not collapsible and cannot be nested. You can see a live example of the nested menu we need here. Note how when you expand the |
I'm wondering if you'd consider adding a feature that allows making the sideNav menu more compact when there are end points sharing the same path prefix. The below is a proof of concept. It seems to work quite well with
redocly preview-docs
, but I'm not very familiar withRedoc
so may be missing things.Add support for theme option
sideNavLayout
. If set tofactored
, the side-nav menu will group items that share a common path prefix.For example, if the default layout for side-nav looked like this:
Then the factored side-nav would look like this:
and after expanding /config, you'd see:
Note that this commit also updates the styling to show a vertical line to the left of all side-bar
<ul>
lists that are not at the root level. This probably should be configurable.Check yourself