-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathsite.jsx
56 lines (49 loc) · 1.68 KB
/
site.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from 'react';
import Interactive from 'antwar-interactive';
import { GoogleAnalytics } from 'antwar-helpers';
import Navigation from '../navigation/navigation';
import Footer from '../footer/footer';
import SidebarMobile from '../sidebar-mobile/sidebar-mobile';
import './site-style';
// Load base styling
import '../../styles';
import '../../styles/icon.font.js';
import '../container/container-style.scss';
import '../navigation/navigation-style';
import '../navigation/search-style';
import '../sidebar-mobile/sidebar-mobile-style';
import '../sidebar-item/sidebar-item-style';
import '../logo/logo-style';
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
}))
}));
// 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">
<Interactive
id="components/navigation/navigation.jsx"
component={ Navigation }
sections={ sections }
pageUrl={ props.children.props.page.url } />
<Interactive
id="components/sidebar-mobile/sidebar-mobile.jsx"
component={ SidebarMobile }
sections={ sections } />
{ props.children }
<Footer />
<GoogleAnalytics analyticsId="UA-46921629-2" />
</div>
);
};