Skip to content

Commit

Permalink
portal: make portal compatible with new gatsby-plugin-mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Aug 6, 2019
1 parent c6ecac3 commit 86b4309
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/dnb-design-system-portal/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
{
resolve: 'gatsby-plugin-page-creator',
options: {
ignore: ['**/*.md', '**/Examples.js'],
ignore: ['**/*.md', '**/Examples.js', '**/*_not_in_use*'],
path: `${__dirname}/src/docs`, // for .js files
name: 'docs'
}
Expand All @@ -51,7 +51,7 @@ module.exports = {
}
},
{
resolve: 'gatsby-mdx',
resolve: 'gatsby-plugin-mdx',
options: {
extensions: ['.md'],
// More info of using plugins: https://github.com/mdx-js/mdx/blob/d4154b8c4a546d0b675826826f85014cc04098c2/docs/plugins.md
Expand Down
14 changes: 5 additions & 9 deletions packages/dnb-design-system-portal/src/templates/mdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PropTypes from 'prop-types'

import Head from 'react-helmet'
import { MDXProvider } from '@mdx-js/react'
import MDXRenderer from 'gatsby-mdx/mdx-renderer'
import { MDXRenderer } from 'gatsby-plugin-mdx'
import { graphql, withPrefix } from 'gatsby'

import Layout from '../shared/parts/Layout'
Expand All @@ -19,7 +19,7 @@ export default class MdxTemplate extends PureComponent {
location,
data: {
mdx: {
code: { body },
body,
frontmatter: { title, description, fullscreen }
},
site: {
Expand Down Expand Up @@ -49,15 +49,13 @@ MdxTemplate.propTypes = {
location: PropTypes.object.isRequired,
data: PropTypes.shape({
mdx: PropTypes.shape({
code: PropTypes.shape({
body: PropTypes.string.isRequired
}).isRequired
body: PropTypes.string.isRequired
}).isRequired
}).isRequired
}

export const pageQuery = graphql`
query($id: String!) {
query MDXQuery($id: String!) {
site {
siteMetadata {
description
Expand All @@ -69,9 +67,7 @@ export const pageQuery = graphql`
description
fullscreen
}
code {
body
}
body
}
}
`

0 comments on commit 86b4309

Please sign in to comment.