site: fix menu item

This commit is contained in:
afc163 2017-04-07 15:14:14 +08:00
parent 0793534665
commit e93dd1e5af

View File

@ -153,7 +153,7 @@ export default class MainContent extends React.Component {
const result = [...topLevel]; const result = [...topLevel];
result.forEach((item, i) => { result.forEach((item, i) => {
const insertCategory = categories.filter( const insertCategory = categories.filter(
cat => (themeConfig.categoryOrder[cat] ? themeConfig.categoryOrder[cat] < i : i === result.length - 1) cat => (themeConfig.categoryOrder[cat] ? themeConfig.categoryOrder[cat] <= i : i === result.length - 1)
)[0]; )[0];
if (insertCategory) { if (insertCategory) {
const target = ( const target = (
@ -161,7 +161,7 @@ export default class MainContent extends React.Component {
{this.generateSubMenuItems(menuItems[insertCategory])} {this.generateSubMenuItems(menuItems[insertCategory])}
</SubMenu> </SubMenu>
); );
result.splice(i, 0, target); result.splice(i + 1, 0, target);
categories.splice(categories.indexOf(insertCategory), 1); categories.splice(categories.indexOf(insertCategory), 1);
} }
}); });