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: sub-categories in sidebar.json #892

Merged
merged 4 commits into from
Oct 8, 2018

Conversation

WillBrock
Copy link
Contributor

@WillBrock WillBrock commented Aug 7, 2018

Motivation

Close #410
Close #948

Some users would like to be able to specify sub categories in the sidebar as discussed in #410.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Added unit tests for the functions that were modified and visually verified existing sidebars function the same as well as the new sub categories.

sub-category-sidebar

Example sidebars:

{
  "docs": {
    "First Category": {
      "Sub Cat One" : ["doc2", "doc3"],
      "Sub Cat Two" : ["doc4", "doc5"]
    },
    "Second Category" : ["doc8"]
  }
}
{
  "docs": {
    "First Category": {
     // Empty key will display no header
      "" : ["doc1"],
      "Sub Cat One" : ["doc2", "doc3"],
      "Sub Cat Two" : ["doc4", "doc5"]
    },
    "Second Category" : ["doc8"]
  }
}

First attempt at implementing this, let me know if some things should be changed. I changed a couple of the functions around to make them easier to write tests against. In the future we could add tests to the rest of the functions in readMetadata.js as well.

Note: We could maybe do some type of accordion for the sub categories if wanted.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Aug 7, 2018

Deploy preview for docusaurus-preview ready!

Built with commit ce549c0

https://deploy-preview-892--docusaurus-preview.netlify.com

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 7, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@endiliey
Copy link
Contributor

endiliey commented Aug 22, 2018

Thanks for the PR and sorry for getting back so late. This is quite a huge change so it will take a while for review.

Update:
https://docusaurus.io/blog/2018/09/11/Towards-Docusaurus-2

With the major re-write and re-architecture for Docusaurus v2, we will be less likely to accept new features/major changes on Docusaurus 1.

@endiliey endiliey self-assigned this Aug 22, 2018
@endiliey endiliey changed the title Add ability to specify sub categories in sidebar.json (new) feat: sub-categories in sidebar.json Aug 23, 2018
@endiliey endiliey removed their assignment Aug 28, 2018
@ricardokdz
Copy link

+1

@markerikson
Copy link

Hi. I see the comments about "less likely to accept v1 PRs". I'm a Redux maintainer, and we're currently investigating switching our docs site at https://redux.js.org to Docusaurus. We've already set it up for the new React-Redux docs page at https://react-redux.js.org .

The Redux docs have multiple levels of nesting in some places. While we're planning on restructuring the docs content itself in the near future, it would be really helpful if we could keep the existing structure for now as part of a switch to Docusaurus.

Would it be possible to get this PR merged in soon (like, the next few days)?

@yangshun
Copy link
Contributor

yangshun commented Oct 7, 2018

Hey @markerikson, that's cool! We'd definitely consider that. I'll look into this further tonight. May I know the reason that you're migrating the Redux docs over from Gitbook to Docusaurus? As far as I can tell, the current Redux docs look great!

@markerikson
Copy link

@yangshun : sure, there's several reasons:

@endiliey endiliey force-pushed the will-sub-categories branch from a68daf6 to df615c6 Compare October 8, 2018 06:53
Copy link
Contributor

@endiliey endiliey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11039152_958432950841733_4258156047983935509_o

@endiliey endiliey merged commit 9544560 into facebook:master Oct 8, 2018
@yangshun
Copy link
Contributor

yangshun commented Oct 8, 2018

@markerikson it's been shipped! Many thanks to @endiliey for making it happen.

We'll release v1.4.1 release very soon (within the next few days) and Redux would be able to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants