Skip to content

Commit

Permalink
feat(OverviewTemplate): Add guide listing filtered to overview path
Browse files Browse the repository at this point in the history
  • Loading branch information
timglaser committed Jun 24, 2020
1 parent aa7474a commit a50e8a0
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 7 deletions.
4 changes: 4 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
component: path.resolve(`src/templates/${frontmatter.template}.js`),
context: {
fileRelativePath: getFileRelativePath(node.fileAbsolutePath),
guidesFilter:
frontmatter.template === 'OverviewTemplate'
? `${frontmatter.path}/*`
: undefined,
},
});
});
Expand Down
3 changes: 3 additions & 0 deletions src/data/sidenav.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"displayName": "Collect data",
"url": "/collect-data",
"children": [
{
"displayName": "Collect data from any source",
Expand All @@ -26,6 +27,7 @@
},
{
"displayName": "Automate workflows",
"url": "/automate-workflows",
"children": [
{
"displayName": "Orchestrate observability workflows",
Expand Down Expand Up @@ -77,6 +79,7 @@
},
{
"displayName": "Explore docs",
"url": "/explore-docs",
"children": [
{
"displayName": "New Relic One CLI",
Expand Down
14 changes: 14 additions & 0 deletions src/markdown-pages/automate-workflows/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
path: '/automate-workflows'
title: 'Automate Workflows'
template: 'OverviewTemplate'
description: ''
---

<Intro>

This guide steps you through adding access to the New Relic time picker to a sample transaction overview application. You also add the selected time to the queries used in the application’s chart components. Start by setting up the sample application and running it locally. Then add the time picker, and some time picker features.

<Video id="inyshp3m7r" type="wistia" />

</Intro>
5 changes: 3 additions & 2 deletions src/markdown-pages/build-apps/index.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
path: '/build-apps'
title: 'Build Custom New Relic Apps'
title: 'Build Apps'
template: 'OverviewTemplate'
description: 'Learn how to build custom New Relic applications'
description: ''
---

<Intro>

This guide steps you through adding access to the New Relic time picker to a sample transaction overview application. You also add the selected time to the queries used in the application’s chart components. Start by setting up the sample application and running it locally. Then add the time picker, and some time picker features.

<Video id="inyshp3m7r" type="wistia" />
Expand Down
14 changes: 14 additions & 0 deletions src/markdown-pages/collect-data/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
path: '/collect-data'
title: 'Collect Data'
template: 'OverviewTemplate'
description: ''
---

<Intro>

This guide steps you through adding access to the New Relic time picker to a sample transaction overview application. You also add the selected time to the queries used in the application’s chart components. Start by setting up the sample application and running it locally. Then add the time picker, and some time picker features.

<Video id="inyshp3m7r" type="wistia" />

</Intro>
14 changes: 14 additions & 0 deletions src/markdown-pages/explore-docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
path: '/explore-docs'
title: 'Explore Docs'
template: 'OverviewTemplate'
description: ''
---

<Intro>

This guide steps you through adding access to the New Relic time picker to a sample transaction overview application. You also add the selected time to the queries used in the application’s chart components. Start by setting up the sample application and running it locally. Then add the time picker, and some time picker features.

<Video id="inyshp3m7r" type="wistia" />

</Intro>
39 changes: 34 additions & 5 deletions src/templates/OverviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { MDXProvider } from '@mdx-js/react';
import { pageContext } from '../types';
import Layout from '../components/Layout';
import PageTitle from '../components/PageTitle';
import GuideListing from '../components/GuideListing/GuideListing';
import GuideTile from '../components/GuideTile';

import Video from '../components/Video';
import Step from '../components/Step';
import Steps from '../components/Steps';
Expand All @@ -24,8 +27,6 @@ import CodeSnippet from '../components/CodeSnippet';

/**
* TODO
* Confirm the open ended markdown space satisfies the design
* Add filtered guide listing
* Share markdown components collection
* Move contexts to wrapRootElement (and remove pageContext)
* Remove extra div from around PageTitle
Expand All @@ -43,7 +44,7 @@ const components = {
};

const OverviewTemplate = ({ data, pageContext }) => {
const { mdx } = data;
const { mdx, guides } = data;
const { frontmatter, body } = mdx;
const { title, description } = frontmatter;
const crumbs = createBreadcrumbs(frontmatter.path, pages);
Expand All @@ -61,6 +62,18 @@ const OverviewTemplate = ({ data, pageContext }) => {
<MDXRenderer>{body}</MDXRenderer>
</MDXProvider>
</div>
{guides?.nodes.length && (
<GuideListing className={styles.guideListing}>
<GuideListing.Heading className={styles.guideListingHeading}>
Guides to build New Relic apps ({guides?.nodes.length})
</GuideListing.Heading>
<GuideListing.List>
{guides?.nodes.map((guide, index) => (
<GuideTile key={index} {...guide?.frontmatter} />
))}
</GuideListing.List>
</GuideListing>
)}
</Layout>
</BreadcrumbContext.Provider>
</PageContext.Provider>
Expand All @@ -73,16 +86,32 @@ OverviewTemplate.propTypes = {
};

export const pageQuery = graphql`
query($path: String!) {
query($path: String!, $guidesFilter: String!) {
mdx(frontmatter: { path: { eq: $path } }) {
body
frontmatter {
duration
path
title
description
}
}
guides: allMdx(
filter: {
frontmatter: {
template: { eq: "GuideTemplate" }
path: { glob: $guidesFilter }
}
}
) {
nodes {
frontmatter {
path
title
description
duration
}
}
}
}
`;

Expand Down
Empty file.

0 comments on commit a50e8a0

Please sign in to comment.