Skip to content

Commit ea506ff

Browse files
committed
chore: Port SideBody, navigation, footer
Still need to look into `Page`.
1 parent 053720d commit ea506ff

File tree

6 files changed

+42
-36
lines changed

6 files changed

+42
-36
lines changed

antwar.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ module.exports = {
1515
plugins: [
1616
prevnextPlugin()
1717
],
18-
layout: function() {
19-
return require('./components/site/site.jsx').default
20-
},
18+
layout: () => require('./components/site/site.jsx').default,
2119
paths: {
2220
'/': {
2321
content: () => (

components/footer/footer.jsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ import Container from '../container/container';
55
import Icon from '../../assets/icon-square-small.svg';
66
import './footer-style';
77

8-
export default (props) => {
9-
return (
10-
<footer className="footer">
11-
<Container className="footer__inner">
12-
<section className="footer__left">
13-
<Link className="footer__link" to="/guides/get-started">Get Started</Link>
14-
<Link className="footer__link" to="/organization">Organization</Link>
15-
<Link className="footer__link" to="/support">Support</Link>
16-
<Link className="footer__link" to="/guides/why-webpack#comparison">Comparison</Link>
17-
</section>
8+
const Footer = () => (
9+
<footer className="footer">
10+
<Container className="footer__inner">
11+
<section className="footer__left">
12+
<Link className="footer__link" to="/guides/get-started/">Get Started</Link>
13+
<Link className="footer__link" to="/organization/">Organization</Link>
14+
<Link className="footer__link" to="/support/">Support</Link>
15+
<Link className="footer__link" to="/guides/why-webpack/#comparison">Comparison</Link>
16+
</section>
1817

19-
<section className="footer__middle">
20-
<Link to="/" className="footer__icon">
21-
<img src={ Icon } />
22-
</Link>
23-
</section>
18+
<section className="footer__middle">
19+
<Link to="/" className="footer__icon">
20+
<img src={ Icon } />
21+
</Link>
22+
</section>
2423

25-
<section className="footer__right">
26-
<Link className="footer__link" to="/branding">Branding</Link>
27-
<Link className="footer__link" to="//gitter.im/webpack/webpack">Gitter</Link>
28-
<Link className="footer__link" to="https://github.com/webpack/webpack/releases">Changelog</Link>
29-
<Link className="footer__link" to="/license">License</Link>
30-
<CC />
31-
</section>
32-
</Container>
33-
</footer>
34-
);
35-
};
24+
<section className="footer__right">
25+
<Link className="footer__link" to="/branding/">Branding</Link>
26+
<Link className="footer__link" to="//gitter.im/webpack/webpack">Gitter</Link>
27+
<Link className="footer__link" to="https://github.com/webpack/webpack/releases">Changelog</Link>
28+
<Link className="footer__link" to="/license/">License</Link>
29+
<CC />
30+
</section>
31+
</Container>
32+
</footer>
33+
);
34+
35+
export default Footer;

components/link/link.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import startsWith from 'lodash/startsWith';
33

44
let RRouter;
55
if (__DEV__) {
6-
RRouter = require('react-router');
6+
RRouter = require('react-router-dom');
77
}
88

99
export default ({ to, ...props }) => {

components/navigation/navigation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class Navigation extends React.Component {
6868
<Link
6969
key={ `navigation__link-${section.title}` }
7070
className={ `navigation__link ${activeMod}` }
71-
to={ `/${section.url}` }>
71+
to={ `/${section.url}/` }>
7272
{ section.title }
7373
</Link>
7474
);

components/site/site.jsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ import '../sidebar-item/sidebar-item-style';
1919
import '../logo/logo-style';
2020
import '../dropdown/dropdown-style.scss';
2121

22-
export default props => {
22+
const SiteBody = ({
23+
children,
24+
section,
25+
location: { pathname }
26+
}) => {
2327
// Retrieve section data
24-
let sections = props.children.props.section.all()
28+
let sections = section.all()
2529
.map(({ title, url, pages }) => ({
2630
title,
2731
url,
@@ -31,6 +35,7 @@ export default props => {
3135
}))
3236
}));
3337

38+
// XXX: Is this needed anymore?
3439
// Rename the root section ("webpack" => "Other") and push it to the end
3540
let rootIndex = sections.findIndex(section => section.title === 'webpack');
3641
let rootSection = sections.splice(rootIndex, 1)[0];
@@ -41,23 +46,25 @@ export default props => {
4146
<div id="site" className="site">
4247
<Interactive
4348
id="components/notification-bar/notification-bar.jsx"
44-
component={ NotificationBar } />
49+
component={NotificationBar} />
4550

4651
<Interactive
4752
id="components/navigation/navigation.jsx"
4853
component={ Navigation }
4954
sections={ sections }
50-
pageUrl={ props.children.props.page.url } />
55+
pageUrl={ pathname } />
5156

5257
<Interactive
5358
id="components/sidebar-mobile/sidebar-mobile.jsx"
5459
component={ SidebarMobile }
5560
sections={ sections } />
5661

57-
{ props.children }
62+
{children}
5863
<Footer />
5964

6065
<GoogleAnalytics analyticsId="UA-46921629-2" />
6166
</div>
6267
);
6368
};
69+
70+
export default SiteBody;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
},
2626
"scripts": {
2727
"start": "npm run init:generated && npm run fetch && node ./antwar.bootstrap.js develop",
28+
"start-only": "node ./antwar.bootstrap.js develop",
2829
"build": "npm run init:generated && npm run fetch && rm -rf build/ && node ./antwar.bootstrap.js build && npm run sitemap && echo webpack.js.org > build/CNAME",
2930
"build-test": "npm run build && http-server build/",
3031
"deploy": "gh-pages -d build",

0 commit comments

Comments
 (0)