Skip to content

Commit

Permalink
fix(content-docs): sidebar generator should return customProps for do…
Browse files Browse the repository at this point in the history
…c items (#9107)
  • Loading branch information
TheCatLady authored and slorber committed Sep 20, 2023
1 parent 2bf528a commit 0236d91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ exports[`DefaultSidebarItemsGenerator generates simple flat sidebar 1`] = `
"type": "doc",
},
{
"customProps": {
"custom": "prop",
},
"id": "doc1",
"label": "doc1 sidebar label",
"type": "doc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe('DefaultSidebarItemsGenerator', () => {
sidebarPosition: 2,
frontMatter: {
sidebar_label: 'doc1 sidebar label',
sidebar_custom_props: {custom: 'prop'},
},
title: '',
unversionedId: 'doc1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ Available doc IDs:
): WithPosition<SidebarItemDoc> {
const {
sidebarPosition: position,
frontMatter: {sidebar_label: label, sidebar_class_name: className},
frontMatter: {
sidebar_label: label,
sidebar_class_name: className,
sidebar_custom_props: customProps,
},
} = getDoc(id);
return {
type: 'doc',
Expand All @@ -149,6 +153,7 @@ Available doc IDs:
// sidebar
...(label !== undefined && {label}),
...(className !== undefined && {className}),
...(customProps !== undefined && {customProps}),
};
}
function createCategoryItem(
Expand Down

0 comments on commit 0236d91

Please sign in to comment.