mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
feat: sub-categories in sidebar.json (#892)
* Add ability to specify sub categories in sidebar.json * move v1 files to correct place * refactor implementation * refactor naming for implementation clarity
This commit is contained in:
parent
d052feec40
commit
954456088c
14 changed files with 535 additions and 88 deletions
|
@ -67,7 +67,22 @@ class SideNav extends React.Component {
|
|||
<h3 className="navGroupCategoryTitle">
|
||||
{this.getLocalizedCategoryString(category.name)}
|
||||
</h3>
|
||||
<ul>{category.links.map(this.renderItemLink, this)}</ul>
|
||||
<ul>
|
||||
{category.links.map(this.renderItemLink, this)}
|
||||
{category.sub_categories &&
|
||||
category.sub_categories.map(this.renderSubCategory, this)}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderSubCategory(subCategory) {
|
||||
return (
|
||||
<div className="navGroup subNavGroup" key={subCategory.name}>
|
||||
<h4 className="navGroupSubCategoryTitle">
|
||||
{this.getLocalizedCategoryString(subCategory.name)}
|
||||
</h4>
|
||||
<ul>{subCategory.links.map(this.renderItemLink, this)}</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue