diff --git a/src/components/PageLayout/RelatedContent.js b/src/components/PageLayout/RelatedContent.js index 390928022..676776416 100644 --- a/src/components/PageLayout/RelatedContent.js +++ b/src/components/PageLayout/RelatedContent.js @@ -1,25 +1,30 @@ import React from 'react'; import PropTypes from 'prop-types'; import { css } from '@emotion/core'; +import usePageContext from '../../hooks/usePageContext'; -const RelatedContent = ({ page, modules }) => ( - -); +const RelatedContent = ({ page, modules }) => { + const pageContext = usePageContext(); + + return ( + + ); +}; RelatedContent.propTypes = { modules: PropTypes.arrayOf(PropTypes.elementType).isRequired, diff --git a/src/components/RelatedContentModules/Contribute.js b/src/components/RelatedContentModules/Contribute.js index 067af23ce..e4e3f9b69 100644 --- a/src/components/RelatedContentModules/Contribute.js +++ b/src/components/RelatedContentModules/Contribute.js @@ -1,12 +1,12 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { css } from '@emotion/core'; import { Button, ExternalLink, Icon } from '@newrelic/gatsby-theme-newrelic'; import { graphql, useStaticQuery } from 'gatsby'; import Section from './Section'; import Title from './Title'; -import usePageContext from '../../hooks/usePageContext'; -const Contribute = () => { +const Contribute = ({ pageContext }) => { const { site } = useStaticQuery(graphql` query { site { @@ -17,7 +17,7 @@ const Contribute = () => { } `); - const { fileRelativePath } = usePageContext(); + const { fileRelativePath } = pageContext; const { siteMetadata: { repository }, @@ -61,4 +61,10 @@ const Contribute = () => { ); }; +Contribute.propTypes = { + pageContext: PropTypes.shape({ + fileRelativePath: PropTypes.string, + }), +}; + export default Contribute;