diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js deleted file mode 100644 index 3307416c6..000000000 --- a/src/components/Sidebar.js +++ /dev/null @@ -1,69 +0,0 @@ -import React, { useState } from 'react'; -import PropTypes from 'prop-types'; -import { css } from '@emotion/core'; -import { Link } from 'gatsby'; -import Navigation from './Navigation'; -import { Logo, SearchInput } from '@newrelic/gatsby-theme-newrelic'; - -const Sidebar = ({ className }) => { - const [searchTerm, setSearchTerm] = useState(''); - - return ( - - ); -}; - -Sidebar.propTypes = { - className: PropTypes.string, -}; - -export default Sidebar; diff --git a/src/layouts/MainLayout.js b/src/layouts/MainLayout.js index 6e8ca43f4..b4f40d9f5 100644 --- a/src/layouts/MainLayout.js +++ b/src/layouts/MainLayout.js @@ -4,68 +4,31 @@ import { css } from '@emotion/core'; import { CookieConsentDialog, GlobalHeader, - GlobalFooter, + Layout, + Logo, + SearchInput, + useLayout, } from '@newrelic/gatsby-theme-newrelic'; -import { graphql, useStaticQuery } from 'gatsby'; import MobileHeader from '../components/MobileHeader'; -import Sidebar from '../components/Sidebar'; +import { Link } from 'gatsby'; +import Navigation from '../components/Navigation'; import '../components/styles.scss'; -import usePageContext from '../hooks/usePageContext'; import { useLocation } from '@reach/router'; -import { useMeasure } from 'react-use'; - -const MainLayout = ({ children }) => { - const { - site: { layout, siteMetadata }, - } = useStaticQuery(graphql` - query { - site { - layout { - contentPadding - maxWidth - } - siteMetadata { - repository - } - } - } - `); +const MainLayout = ({ children, pageContext }) => { + const { contentPadding, maxWidth } = useLayout(); const location = useLocation(); - const { fileRelativePath } = usePageContext(); - const [headerRef, { height }] = useMeasure(); + const [searchTerm, setSearchTerm] = useState(''); + const { fileRelativePath } = pageContext; const [isMobileNavOpen, setIsMobileNavOpen] = useState(false); - const isComponentDoc = fileRelativePath.includes( - 'src/markdown-pages/components' - ); - const editUrl = isComponentDoc - ? null - : `${siteMetadata.repository}/blob/main/${fileRelativePath}`; useEffect(() => { setIsMobileNavOpen(false); }, [location.pathname]); return ( -