forked from nodejs/nodejs.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearn.tsx
More file actions
58 lines (55 loc) · 1.28 KB
/
learn.tsx
File metadata and controls
58 lines (55 loc) · 1.28 KB
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
57
58
import { graphql } from 'gatsby';
import React from 'react';
import Article from '../components/article';
import Hero from '../components/hero';
import Layout from '../components/layout';
import Navigation from '../components/navigation';
import { LearnPageContext, LearnPageData } from '../types';
type Props = {
data: LearnPageData;
pageContext: LearnPageContext;
};
export default ({
data: {
doc: {
frontmatter: { title, description },
html,
tableOfContents,
fields: { authors },
},
},
pageContext: { slug, next, previous, relativePath, navigationData },
}: Props) => {
return (
<Layout title={title} description={description}>
<Hero title={title} />
<Navigation currentSlug={slug} sections={navigationData} />
<Article
title={title}
html={html}
tableOfContents={tableOfContents}
next={next}
authors={authors}
previous={previous}
relativePath={relativePath}
/>
</Layout>
);
};
export const query = graphql`
query DocBySlug($slug: String!) {
doc: markdownRemark(fields: { slug: { eq: $slug } }) {
id
html
tableOfContents
frontmatter {
title
description
}
fields {
slug
authors
}
}
}
`;