Skip to content

Commit

Permalink
factor out common content to a fragment (#25593)
Browse files Browse the repository at this point in the history
  • Loading branch information
tesseralis committed Jul 8, 2020
1 parent 84e3be3 commit 238d629
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
20 changes: 17 additions & 3 deletions www/src/components/docs-markdown-page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx jsx */
import { jsx } from "theme-ui"
import React from "react"
import { graphql } from "gatsby"
import { MDXRenderer } from "gatsby-plugin-mdx"
import { mediaQueries } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"

Expand All @@ -25,7 +25,7 @@ const containerStyles = {
px: 9,
}

function DocsMarkdownPage({
export default function DocsMarkdownPage({
page,
location,
prev,
Expand Down Expand Up @@ -126,4 +126,18 @@ function DocsMarkdownPage({
)
}

export default DocsMarkdownPage
export const docPageContentFragment = graphql`
fragment DocPageContent on DocPage {
relativePath
slug
body
excerpt
timeToRead
tableOfContents
anchor
title
description
disableTableOfContents
tableOfContentsDepth
}
`
12 changes: 1 addition & 11 deletions www/src/templates/template-api-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,9 @@ export default function APITemplate({ data, location, pageContext }) {
export const pageQuery = graphql`
query($path: String!, $jsdoc: [String], $apiCalls: String) {
docPage(slug: { eq: $path }) {
relativePath
slug
body
excerpt
timeToRead
tableOfContents
anchor
title
description
...DocPageContent
contentsHeading
showTopLevelSignatures
disableTableOfContents
tableOfContentsDepth
}
jsdoc: allFile(filter: { relativePath: { in: $jsdoc } }) {
nodes {
Expand Down
12 changes: 1 addition & 11 deletions www/src/templates/template-docs-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,8 @@ export default DocsTemplate
export const pageQuery = graphql`
query($slug: String!) {
docPage(slug: { eq: $slug }) {
relativePath
slug
body
excerpt
timeToRead
tableOfContents
anchor
title
description
...DocPageContent
issue
disableTableOfContents
tableOfContentsDepth
}
}
`

0 comments on commit 238d629

Please sign in to comment.