Skip to content

feat: docs plugin options sidebarCollapsible + sidebarCollapsed - #5203

Merged
slorber merged 17 commits into
meta:masterfrom
Josh-Cena:sidebar-section
Jul 23, 2021
Merged

slorber merged 17 commits into
meta:masterfrom
Josh-Cena:sidebar-section

Conversation

@Josh-Cena

@Josh-Cena Josh-Cena commented Jul 22, 2021 •

Copy link
Copy Markdown
Collaborator

Breaking changes

  • themeConfig.sidebarCollapsible is moved to docs plugin options.sidebarCollapsible

Motivation

Resolve #4966.

Add a docs options.sidebarCollapsed plugin config.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

tests + https://deploy-preview-5203--docusaurus-2.netlify.app/tests/docs/more-test/

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jul 22, 2021
Signed-off-by: Josh-Cena <[email protected]>
Signed-off-by: Josh-Cena <[email protected]>
Signed-off-by: Josh-Cena <[email protected]>
@netlify

netlify Bot commented Jul 22, 2021

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 22, 2021 •

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 74
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5203--docusaurus-2.netlify.app/

Signed-off-by: Josh-Cena <[email protected]>
@netlify

netlify Bot commented Jul 22, 2021

Copy link
Copy Markdown

@netlify

netlify Bot commented Jul 22, 2021 •

Copy link
Copy Markdown

Signed-off-by: Josh-Cena <[email protected]>

@slorber slorber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 thanks, overall LGTM

@Josh-Cena

Josh-Cena commented Jul 23, 2021 •

Copy link
Copy Markdown
Collaborator Author

@slorber I've created two config options: sidebarCollapsible and sidebarCollapsed. Instead of throwing error/warning when a category is collapsed but non-expandable, collapsed is just forced to false when !collapsible—we can notify this behavior in the docs. Part of the reason is because I'm getting tired of writing validation 😅

@Josh-Cena
Josh-Cena marked this pull request as ready for review July 23, 2021 07:49
@Josh-Cena
Josh-Cena requested a review from lex111 as a code owner July 23, 2021 07:49
@slorber slorber added pr: new feature This PR adds a new API or behavior. pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. labels Jul 23, 2021
@slorber slorber changed the title feat: non-collapsible sidebar category feat: docs plugin options sidebarCollapsible + sidebarCollapsed Jul 23, 2021
@slorber
slorber merged commit 24156ef into meta:master Jul 23, 2021
@Josh-Cena
Josh-Cena deleted the sidebar-section branch July 23, 2021 12:26
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
…#5203)

* Add prop

Signed-off-by: Josh-Cena <[email protected]>

* Add `collapsible` option to sidebar item

Signed-off-by: Josh-Cena <[email protected]>

* Add eslint-ignore

Signed-off-by: Josh-Cena <[email protected]>

* Move new page

Signed-off-by: Josh-Cena <[email protected]>

* Allow in autogenerated

Signed-off-by: Josh-Cena <[email protected]>

* Fix tests

Signed-off-by: Josh-Cena <[email protected]>

* Move config options to plugin-docs

Signed-off-by: Josh-Cena <[email protected]>

* Make non-collapsible items always expanded

Signed-off-by: Josh-Cena <[email protected]>

* docs versioning cli should receive a single options object

* Update cli.test.ts

* revert validateCategoryMetadataFile change

* remove theme usage of themeConfig.sidebarCollapsible

* better handling of sidebar item category inconsistencies + add warning message

* Update snapshot

Signed-off-by: Josh-Cena <[email protected]>

* Handle plugin option inconsistencies

* improve doc for new sidebarCollapsible doc options

* remove warning in fixSidebarItemInconsistencies as it will be annoyed for versioned sites, as "collapsed" is already persisted in sidebar json files

Co-authored-by: slorber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: new feature This PR adds a new API or behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sidebar Category Title / Non-collapsable primary categories.

3 participants