mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-19 09:37:43 +02:00
fix(docs): Fix empty sidebar item category className
lost when post-processed to a doc (#11281)
This commit is contained in:
parent
068d4c63a9
commit
1cbc0118b0
10 changed files with 45 additions and 20 deletions
|
@ -76,6 +76,10 @@ exports[`postProcess transforms category without subitems 1`] = `
|
|||
{
|
||||
"sidebar": [
|
||||
{
|
||||
"className": "category-className",
|
||||
"customProps": {
|
||||
"custom": true,
|
||||
},
|
||||
"id": "doc ID",
|
||||
"label": "Category 2",
|
||||
"type": "doc",
|
||||
|
|
|
@ -31,6 +31,8 @@ describe('postProcess', () => {
|
|||
type: 'doc',
|
||||
id: 'doc ID',
|
||||
},
|
||||
className: 'category-className',
|
||||
customProps: {custom: true},
|
||||
items: [],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -77,10 +77,13 @@ function postProcessSidebarItem(
|
|||
) {
|
||||
return null;
|
||||
}
|
||||
const {label, className, customProps} = category;
|
||||
return {
|
||||
type: 'doc',
|
||||
label: category.label,
|
||||
id: category.link.id,
|
||||
label,
|
||||
...(className && {className}),
|
||||
...(customProps && {customProps}),
|
||||
};
|
||||
}
|
||||
// A non-collapsible category can't be collapsed!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue