Merge pull request #149 from pbxothi/patch-1

Fix window is undefined
This commit is contained in:
Eric Liu 2020-03-09 08:00:27 -07:00 committed by GitHub
commit fbf539ab1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,21 +16,14 @@
import HamburgerMenu from './UIShellSideNav/HamburgerMenu.svelte';
let isSideNavOpen = undefined;
let winWidth = window.innerWidth;
window.addEventListener('resize', () => {
winWidth = window.innerWidth;
if (winWidth >= 1056) {
isSideNavOpen = true;
} else {
isSideNavOpen = false;
}
});
let winWidth = undefined;
$: isSideNavOpen = winWidth >= 1056
$: ariaLabel = company + (uiShellAriaLabel || $$props['aria-label'] || platformName);
</script>
<svelte:window bind:innerWidth={winWidth} />
<header aria-label={ariaLabel} class={cx('--header')} role="banner">
{#if winWidth < 1056}
<HamburgerMenu bind:isOpen={isSideNavOpen} />