Skip to content

Commit 296dad6

Browse files
committed
fix(mobile): clean up and simplify link/section data passed to SidebarMobile
1 parent d0513c5 commit 296dad6

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

components/site/site.jsx

+12-15
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,19 @@ import '../sidebar-item/sidebar-item-style';
1919
import '../logo/logo-style';
2020

2121
export default props => {
22-
// Retrieve section data
23-
let sections = props.children.props.section.all()
24-
.map(({ title, url, pages }) => ({
25-
title,
26-
url,
27-
pages: pages.map(({ title, url }) => ({
28-
title: title || url, // XXX: Title shouldn't be coming in as undefined
29-
url
22+
// Retrieve and clean up section data
23+
let sections = (
24+
props.children.props.section.all()
25+
.filter(section => section.pages.length !== 0)
26+
.map(({ title, url, pages }) => ({
27+
title,
28+
url,
29+
pages: pages.map(({ title, url }) => ({
30+
title: title || url, // XXX: Title shouldn't be coming in as undefined
31+
url
32+
}))
3033
}))
31-
}));
32-
33-
// Rename the root section ("webpack" => "Other") and push it to the end
34-
let rootIndex = sections.findIndex(section => section.title === 'webpack');
35-
let rootSection = sections.splice(rootIndex, 1)[0];
36-
rootSection.title = 'Other';
37-
sections.push(rootSection);
34+
);
3835

3936
return (
4037
<div id="site" className="site">

0 commit comments

Comments
 (0)