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(theme): support multi-level sidebar #851

Merged
merged 6 commits into from Jul 23, 2022

Conversation

yizhi996
Copy link
Contributor

@yizhi996 yizhi996 commented Jun 24, 2022

#737, fixes #926

Preview:

Screen Shot 2022-06-24 at 21 29 49

@yizhi996 yizhi996 closed this Jun 30, 2022
@brc-dd
Copy link
Member

brc-dd commented Jul 2, 2022

Hi! Did you accidently close this PR?

@brc-dd brc-dd reopened this Jul 2, 2022
@brc-dd brc-dd changed the title feat: sidebar supported multi level feat(theme): support multi-level sidebar Jul 2, 2022
@yizhi996
Copy link
Contributor Author

yizhi996 commented Jul 2, 2022

Hi! Did you accidently close this PR?

Hello, I found a css wrong and temporarily closed this PR.

@brc-dd
Copy link
Member

brc-dd commented Jul 2, 2022

Ah okay! Kia will review this once he gets some time. By the way, you can also convert a PR to draft while you're working on it.

@yizhi996
Copy link
Contributor Author

yizhi996 commented Jul 2, 2022

Ah okay! Kia will review this once he gets some time. By the way, you can also convert a PR to draft while you're working on it.

Thanks, I learned.

@brc-dd brc-dd mentioned this pull request Jul 7, 2022
4 tasks
@YangYongAn
Copy link

期待该 pr 早日合并

@SebasG22
Copy link

Looking forward to having this merged!

@cy920820
Copy link

Early release pls ~~

types/default-theme.d.ts Outdated Show resolved Hide resolved
@brc-dd brc-dd force-pushed the feat/multi-level-sidebar branch 2 times, most recently from 627c344 to 6e58475 Compare July 22, 2022 14:07
@brc-dd
Copy link
Member

brc-dd commented Jul 22, 2022

@yizhi996 Hey I did some updates. Can you check if current code works fine?

@titouanmathis
Copy link

I think the getFlatSideBarLinks function in theme-defaults/supports/sidebar.ts should be recursive, too. It currently only goes one level deep, which seems to break the prev and next footer links resolution when I last tested it.

I think that the following function could work recursively (demo):

function getFlatSideBarLinks(sidebar) {
  return sidebar
    .map((item) =>
      Array.isArray(item.items)
        ? [item, ...getFlatSideBarLinks(item.items)]
        : [item]
    )
    .flat();
}

I tested it on this branch, and it seems to work (although TypeScript is not happy):

Before After
Capture d’écran 2022-07-22 à 21 36 30 Capture d’écran 2022-07-22 à 21 37 44

@brc-dd
Copy link
Member

brc-dd commented Jul 22, 2022

Ah, yes thanks @titouanmathis. This actually slipped my mind. Will fix this tomorrow. I'm marking the PR as draft for now.

@brc-dd brc-dd marked this pull request as draft July 22, 2022 20:43
@yizhi996
Copy link
Contributor Author

@brc-dd Thanks for the updates to the PR! now it works with link be empty

@yizhi996
Copy link
Contributor Author

@brc-dd @titouanmathis I have fixed prev and next footer links problem, please check it works fine, thanks.

@brc-dd brc-dd marked this pull request as ready for review July 23, 2022 05:48
@brc-dd brc-dd merged commit d1a2c76 into vuejs:main Jul 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 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.

Support multi-level sidebar
6 participants