Skip to content

Commit

Permalink
fix: add back editUrl prop for global header
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Sep 3, 2020
1 parent af4267a commit 1456db6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/layouts/MainLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,39 @@ import MobileHeader from '../components/MobileHeader';
import Sidebar from '../components/Sidebar';
import CookieApprovalDialog from '../components/CookieApprovalDialog';
import '../components/styles.scss';
import usePageContext from '../hooks/usePageContext';
import { useLocation } from '@reach/router';

const gaTrackingId = 'UA-3047412-33';
const gdprConsentCookieName = 'newrelic-gdpr-consent';

const MainLayout = ({ children }) => {
const {
site: { layout },
site: { layout, siteMetadata },
} = useStaticQuery(graphql`
query {
site {
layout {
contentPadding
maxWidth
}
siteMetadata {
repository
}
}
}
`);

const location = useLocation();
const { fileRelativePath } = usePageContext();
const [cookieConsent, setCookieConsent] = useState(false);
const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
const isComponentDoc = fileRelativePath.includes(
'src/markdown-pages/components'
);
const editUrl = isComponentDoc
? null
: `${siteMetadata.repository}/blob/main/${fileRelativePath}`;

useEffect(() => {
const consentValue = Cookies.get(gdprConsentCookieName) === 'true';
Expand Down Expand Up @@ -68,7 +79,7 @@ const MainLayout = ({ children }) => {
</script>
) : null}
</Helmet>
<GlobalHeader search />
<GlobalHeader editUrl={editUrl} />
<MobileHeader
css={css`
@media (min-width: 761px) {
Expand Down

0 comments on commit 1456db6

Please sign in to comment.