feat(v2): expanded sidebar categories by default (#2682)

* feat: update sidebar categ to  take collapsed prop

* feat: add extra sidebars collapsed test

* fix: only mutate item.collapsed if necessary

* feat: update docs for SidebarItemCategory

* fix: update snapshots

* fix: update json to match new sidebar schema

* fix: update last snapshot

* refactor: check if item should be expanded

* docs: update sidebar categories section

* refactor: use new collpased on docusaurus

* feat: only highlight category for active page

* fix: check for window

* refactor: use ExecutionEnviornment

* refactor: make isCategoryOfActivePage pure

* fix: rename docs to docs-introduction in sidebars

* Update docs.md

* misc: remove setting for every sidebar

Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
This commit is contained in:
Joe Previte 2020-05-27 22:17:19 -07:00 committed by GitHub
parent d8ebe8b2e4
commit 07b9e9cd62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 273 additions and 26 deletions

View file

@ -126,4 +126,19 @@ describe('loadSidebars', () => {
const result = loadSidebars(null);
expect(result).toEqual({});
});
test('sidebars with category.collapsed property', async () => {
const sidebarPath = path.join(fixtureDir, 'sidebars-collapsed.json');
const result = loadSidebars([sidebarPath]);
expect(result).toMatchSnapshot();
});
test('sidebars with category.collapsed property at first level', async () => {
const sidebarPath = path.join(
fixtureDir,
'sidebars-collapsed-first-level.json',
);
const result = loadSidebars([sidebarPath]);
expect(result).toMatchSnapshot();
});
});