Skip to content

Commit

Permalink
chore: use usePageContext hook in layout
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jul 29, 2020
1 parent a78d3d8 commit 4329cb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/layouts/MainLayout.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useContext, useState, useEffect } from 'react';
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/core';

import { Helmet } from 'react-helmet';
import { GlobalHeader } from '@newrelic/gatsby-theme-newrelic';
import { PageContext } from '../components/PageContext';
import { graphql, useStaticQuery } from 'gatsby';
import Cookies from 'js-cookie';
import Footer from '../components/Footer';
Expand All @@ -13,6 +12,7 @@ import Sidebar from '../components/Sidebar';
import CookieApprovalDialog from '../components/CookieApprovalDialog';
import RelatedContent from '../components/RelatedContent';
import '../components/styles.scss';
import usePageContext from '../hooks/usePageContext';

const gaTrackingId = 'UA-3047412-33';
const gdprConsentCookieName = 'newrelic-gdpr-consent';
Expand All @@ -33,7 +33,8 @@ const MainLayout = ({ children }) => {
}
}
`);
const { fileRelativePath } = useContext(PageContext);

const { fileRelativePath } = usePageContext();
const [cookieConsent, setCookieConsent] = useState(false);
const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
const isComponentDoc = fileRelativePath.includes(
Expand Down

0 comments on commit 4329cb5

Please sign in to comment.