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

feat: add support for collapsible multi-level sidebar #1361

Closed
wants to merge 9 commits into from

Conversation

LittleSound
Copy link
Member

@LittleSound LittleSound commented Sep 18, 2022

fixes #1360

I would like to have to collapsible navigation sidebar since I organize my documents by using multiple layers of folders, which is frustrating to browse or lookup the content/page I want.

VitePress only supports the top-level folders to be collapsible in the navigation sidebar currently.

demo

I'm using this feature in my knowledge base site, if you want you can go see the results: Nólëbase

collapsed
image
expand
image

description

  • When this node is both a page and a parent node, a split line will be added between the collapse button and the link to distinguish the functional area.
  • If there are no links to jump to, switch to expand when clicking on the text
  • Auto-expand active routes

@LittleSound LittleSound marked this pull request as ready for review September 18, 2022 14:28
@Zhengqbbb
Copy link
Contributor

Zhengqbbb commented Oct 25, 2022

I note a feature. I dont it is need to support. But i think it will be nice~ 🧐

About enter page auto expand collapsed: true item by URL.

like navbar active option: active highlight will have problems once there is a conflict

The demo: I have collapsed: true item. when i refresh or enter page by URL. The sidebar which collapsed: true item can be expanded.🤗

screen-capture.webm

@brc-dd
Copy link
Member

brc-dd commented Oct 25, 2022

@Zhengqbbb It should open by default, we added that in #1094 . Can you confirm it's not auto expanding on the latest version? If so, please create a new issue. We'll fix that.

@LittleSound
Copy link
Member Author

@Zhengqbbb It should open by default, we added that in #1094 . Can you confirm it's not auto expanding on the latest version? If so, please create a new issue. We'll fix that.

I actually found this problem in the code when I wrote this PR, and I wanted to submit a PR to rewrite that part of the problematic code with multi-layered collapsed sidebar supported after I finished this multi-layered collapsed navigation bar feature, but this PR was put on hold.

@LittleSound
Copy link
Member Author

LittleSound commented Oct 29, 2022

@Zhengqbbb @brc-dd I implemented the auto-expand feature for the multi-layer navigation bar in the last commit, and it's now faster since it doesn't need to Iterating over the entire route 🚀 .

2022-10-29.17.49.44.mov

@kiaking
Copy link
Member

kiaking commented Jan 20, 2023

I've opened new PR due to quite large design concept difference.
https://github.com/vuejs/vitepress/compare/1360-2nd-level-sidebar-collapse

kiaking added a commit that referenced this pull request Jan 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for collapsible multi-level sidebar
5 participants