Skip to content

Commit

Permalink
chore: used ResizeObserver to get correct header height
Browse files Browse the repository at this point in the history
  • Loading branch information
zstix committed Sep 8, 2020
1 parent 425262f commit fcf4ed1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/layouts/MainLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ const MainLayout = ({ children }) => {
? null
: `${siteMetadata.repository}/blob/main/${fileRelativePath}`;

const resizeObserver = new ResizeObserver((entries) => {
entries.forEach((entry) => {
setHeaderHeight(entry.contentBoxSize.blockSize);
});
});

useEffect(() => {
const consentValue = Cookies.get(gdprConsentCookieName) === 'true';
consentValue && setCookieConsent(true);
Expand Down

0 comments on commit fcf4ed1

Please sign in to comment.