Revert "feat(v2): add option to toggle sidebar category open by default (#2613)" (#2644)

This reverts commit 1863a3c805.
This commit is contained in:
Alexey Pyltsyn 2020-04-22 18:50:18 +03:00 committed by GitHub
parent 7d792840ba
commit 510bec6532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 3 additions and 176 deletions

View file

@ -33,7 +33,6 @@ function normalizeCategoryShorthand(
): SidebarItemCategoryRaw[] {
return Object.entries(sidebar).map(([label, items]) => ({
type: 'category',
collapsed: true,
label,
items,
}));
@ -57,7 +56,7 @@ function assertItem(item: Object, keys: string[]): void {
}
function assertIsCategory(item: any): asserts item is SidebarItemCategoryRaw {
assertItem(item, ['items', 'label', 'collapsed']);
assertItem(item, ['items', 'label']);
if (typeof item.label !== 'string') {
throw new Error(
`Error loading ${JSON.stringify(item)}. "label" must be a string.`,
@ -68,12 +67,6 @@ function assertIsCategory(item: any): asserts item is SidebarItemCategoryRaw {
`Error loading ${JSON.stringify(item)}. "items" must be an array.`,
);
}
// "collapsed" is an optional property
if (item.hasOwnProperty('collapsed') && typeof item.collapsed !== 'boolean') {
throw new Error(
`Error loading ${JSON.stringify(item)}. "collapsed" must be a boolean.`,
);
}
}
function assertIsDoc(item: any): asserts item is SidebarItemDoc {