Skip to content

Commit

Permalink
fix(mobile): clean up and simplify link/section data passed to `Sideb…
Browse files Browse the repository at this point in the history
…arMobile`
  • Loading branch information
skipjack committed May 8, 2017
1 parent f20b530 commit c34eba0
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions components/site/site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,19 @@ import '../logo/logo-style';
import '../dropdown/dropdown-style.scss';

export default props => {
// Retrieve section data
let sections = props.children.props.section.all()
.map(({ title, url, pages }) => ({
title,
url,
pages: pages.map(({ title, url }) => ({
title: title || url, // XXX: Title shouldn't be coming in as undefined
url
// Retrieve and clean up section data
let sections = (
props.children.props.section.all()
.filter(section => section.pages.length !== 0)
.map(({ title, url, pages }) => ({
title,
url,
pages: pages.map(({ title, url }) => ({
title: title || url, // XXX: Title shouldn't be coming in as undefined
url
}))
}))
}));

// Rename the root section ("webpack" => "Other") and push it to the end
let rootIndex = sections.findIndex(section => section.title === 'webpack');
let rootSection = sections.splice(rootIndex, 1)[0];
rootSection.title = 'Other';
sections.push(rootSection);
);

return (
<div id="site" className="site">
Expand Down

0 comments on commit c34eba0

Please sign in to comment.