Skip to content

Commit 406a9ff

Browse files
committed
Port page layout to the new system
1 parent ea506ff commit 406a9ff

File tree

1 file changed

+60
-51
lines changed

1 file changed

+60
-51
lines changed

components/page/page.jsx

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,62 +11,71 @@ import '../sidebar/sidebar-style';
1111
import '../sponsors/sponsors-style';
1212
import '../gitter/gitter-style';
1313

14-
export default ({ section, page }) => (
15-
<Container className="page">
14+
const Page = ({ page, section }) => {
15+
const {
16+
file: {
17+
attributes: {
18+
anchors,
19+
contributors,
20+
title,
21+
related,
22+
},
23+
body
24+
},
25+
url,
26+
} = page;
1627

17-
<Sponsors />
28+
return (
29+
<Container className="page">
30+
<Sponsors />
31+
<Interactive
32+
id="components/sidebar/sidebar.jsx"
33+
component={ Sidebar }
34+
sectionName={ section.name }
35+
pages={ section.pages().map(page => ({ url, title, anchors })) }
36+
currentPage={ url } />
1837

19-
<Interactive
20-
id="components/sidebar/sidebar.jsx"
21-
component={ Sidebar }
22-
sectionName={ section.name }
23-
pages={ section.pages().map(page => ({
24-
url: page.url,
25-
title: page.title,
26-
anchors: page.anchors
27-
})) }
28-
currentPage={ page.url.replace('/index', '') } />
38+
<section className="page__content">
39+
<h1>{ title }</h1>
2940

30-
<section className="page__content">
31-
<h1>{ page.title }</h1>
41+
<PageLinks
42+
page={ page }
43+
section={ section.name } />
3244

33-
<PageLinks
34-
page={ page }
35-
section={ section.name } />
45+
<div dangerouslySetInnerHTML={{ __html: body }} />
3646

37-
<div dangerouslySetInnerHTML={{
38-
__html: page.content
39-
}} />
47+
{ related.length > 0 && (
48+
<div>
49+
<hr />
50+
<h3>Further Reading</h3>
51+
<ul>
52+
{
53+
related.map((link, index) => (
54+
<li key={ index }>
55+
<a href={ link.url }>
56+
{ link.title }
57+
</a>
58+
</li>
59+
))
60+
}
61+
</ul>
62+
</div>
63+
)}
4064

41-
{ page.related.length > 0 ? (
42-
<div>
43-
<hr />
44-
<h3>Further Reading</h3>
45-
<ul>
46-
{
47-
page.related.map((link, index) => (
48-
<li key={ index }>
49-
<a href={ link.url }>
50-
{ link.title }
51-
</a>
52-
</li>
53-
))
54-
}
55-
</ul>
56-
</div>
57-
) : null }
65+
{ contributors.length > 0 && (
66+
<div>
67+
<hr />
68+
<h3>Contributors</h3>
69+
<Contributors contributors={ contributors } />
70+
</div>
71+
)}
5872

59-
{ page.contributors.length > 0 ? (
60-
<div>
61-
<hr />
62-
<h3>Contributors</h3>
63-
<Contributors contributors={ page.contributors } />
64-
</div>
65-
) : null }
73+
<Interactive
74+
id="components/gitter/gitter.jsx"
75+
component={ Gitter } />
76+
</section>
77+
</Container>
78+
);
79+
};
6680

67-
<Interactive
68-
id="components/gitter/gitter.jsx"
69-
component={ Gitter } />
70-
</section>
71-
</Container>
72-
);
81+
export default Page;

0 commit comments

Comments
 (0)