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-default): refine sidebar groups #1257

Merged
merged 12 commits into from
Feb 3, 2019

Conversation

ulivz
Copy link
Member

@ulivz ulivz commented Feb 3, 2019

Summary

This PR contains following features:

  1. sidebarDepth for a specified sidebar group;
module.exports = {
  themeConfig: {
    sidebarDepth: 1, /* Default sidebar depth */
    sidebar: [
      {
        title: 'foo',
        sidebarDepth: 2,  /* Override default sidebar depth for current sidebar */
        children: [
          ['', 'README'],
          'a',
          'b',
          'c',
          'd'
        ]
      }
    ]
  }
}

e.g.

  • Change:

image

  • Before | After

  1. Nested sidebar groups;
module.exports = {
  themeConfig: {
    sidebar: [
      {
        title: 'foo',
        children: [
          ['', 'README'],
          'a',
          'b',
          {
            title: 'foo/child',
            children: [
              'c',
              'd'
            ]
          }
        ]
      }
    ]
  }
}
  1. Clickable heading for sidebar groups.
module.exports = {
  themeConfig: {
    sidebar: [
      {
        title: 'foo',
        path: '/foo/', /* Sidebar of current heading will be clickable like a route link */
        children: [
          ['', 'README'],
          'a',
          'b',
        ]
      }
    ]
  }
}

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@ulivz ulivz force-pushed the feat/clickable-sidebar-heading branch from 32d2cc1 to 1cf18fd Compare February 3, 2019 13:57
@ulivz ulivz force-pushed the feat/clickable-sidebar-heading branch from 1cf18fd to b0deea0 Compare February 3, 2019 13:57
@ulivz ulivz mentioned this pull request Feb 3, 2019
18 tasks
@ulivz
Copy link
Member Author

ulivz commented Feb 3, 2019

cc @zyy7259

@ulivz ulivz merged commit 01dd45b into master Feb 3, 2019
@davestewart
Copy link

Great! Much clearer than #669

@ulivz ulivz deleted the feat/clickable-sidebar-heading branch February 17, 2019 17:29
@sirien-neiris
Copy link

sirien-neiris commented Feb 18, 2019

Hi. Question, if I may.

It seems that this only allows creating "higher order" collapsing items in the menu (= there are source files, every source file is its own collapsible item in the menu, this allows to create one higher order collapsible item under which will cover this "standard level" items)

Is there a way how to make LOWER items in the menu collapsible? (= to make every lower-level heading inside source files collapsible as well)

We would really need this option, but it seems VuePress currently doesn't allow that :(

@lunaceee
Copy link

lunaceee commented Mar 21, 2019

Can I ask how the folder structure looks like for this?

module.exports = {
  themeConfig: {
    sidebar: [
      {
        title: 'foo',
        children: [
          ['', 'README'],
          'a',
          'b',
          {
            title: 'foo/child',
            children: [
              'c',
              'd'
            ]
          }
        ]
      }
    ]
  }
}

What i'm trying to achieve:

Topic Group 1
- Page 1A
    - Sub-page 1A-a
    - Sub-page 1A-b
- Page 1B
- Page 1C
    - Subpage 1C-a

Topic Group 2
- Page 2A
- Page 2B
    - Sub-page 2B-a
    - Sub-page 2B-b
- Page 2C

Sub-page is also a page instead of heading, it seems that this feature is shipped in. I tried creating nested folders but ran into this error in the console [vuepress] Nested sidebar groups are not supported. Consider using navbar + categories instead.

Thanks!

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.

4 participants