-
Notifications
You must be signed in to change notification settings - Fork 113
/
GuideTemplate.js
101 lines (94 loc) · 2.4 KB
/
GuideTemplate.js
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import React from 'react';
import { graphql } from 'gatsby';
import { css } from '@emotion/react';
import PropTypes from 'prop-types';
import { PageUpdated } from '../components/RelatedContentModules';
import PageLayout from '../components/PageLayout';
import FeatherIcon from '../components/FeatherIcon';
import DevSiteSeo from '../components/DevSiteSeo';
import {
ContributingGuidelines,
Layout,
RelatedResources,
SimpleFeedback,
} from '@newrelic/gatsby-theme-newrelic';
const GuideTemplate = ({ data, location }) => {
const { mdx } = data;
const {
frontmatter,
body,
relatedResources,
fields: { fileRelativePath, slug },
} = mdx;
const { title, description, duration, tags } = frontmatter;
return (
<>
<DevSiteSeo
title={title}
description={description}
tags={tags}
location={location}
/>
<PageLayout type={PageLayout.TYPE.RELATED_CONTENT}>
<PageLayout.Header title={title}>
{duration && (
<div
css={css`
display: flex;
align-items: center;
color: var(--secondary-text-color);
white-space: nowrap;
`}
>
<FeatherIcon
name="clock"
css={css`
margin-right: 0.25rem;
`}
/>
{duration} min
</div>
)}
</PageLayout.Header>
<PageLayout.MarkdownContent>{body}</PageLayout.MarkdownContent>
<Layout.PageTools>
<SimpleFeedback
pageTitle={title}
slug={slug}
labels={['content', 'feedback']}
/>
<ContributingGuidelines fileRelativePath={fileRelativePath} />
<RelatedResources resources={relatedResources} />
<PageUpdated page={mdx} />
</Layout.PageTools>
</PageLayout>
</>
);
};
GuideTemplate.propTypes = {
data: PropTypes.object,
location: PropTypes.object.isRequired,
};
export const pageQuery = graphql`
query($slug: String!) {
mdx(fields: { slug: { eq: $slug } }) {
body
frontmatter {
duration
title
description
tags
}
fields {
fileRelativePath
slug
}
relatedResources(limit: 5) {
title
url
}
...PageUpdated_page
}
}
`;
export default GuideTemplate;