Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add group titles to navigation #9695

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/docs/business-logic/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Business Logic",
"position": 79
}
Empty file.
4 changes: 4 additions & 0 deletions docs/docs/data-api/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Data API",
"position": 21
}
Empty file.
4 changes: 4 additions & 0 deletions docs/docs/release/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Release",
"position": 129
}
Empty file.
11 changes: 11 additions & 0 deletions docs/src/theme/DocSidebarItem/Category/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
setCollapsed(true);
}
}, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]);

if (groupTitles.includes(label)) {
return <GroupTitle>{label}</GroupTitle>;
}

return (
<li
className={clsx(
Expand Down Expand Up @@ -201,3 +206,9 @@ export default function DocSidebarItemCategory({ item, onItemClick, activePath,
</li>
);
}

function GroupTitle({ children }) {
return <div style={{ fontSize: '0.9em', margin: '8px 0 4px 0' }}>{children}</div>;
}

const groupTitles = ['Data API', 'Business Logic', 'Release'];