From ee27d7b8cd9d12688a173f2c4378bf75bf841a90 Mon Sep 17 00:00:00 2001
From: Amandeep <47453037+pbxothi@users.noreply.github.com>
Date: Sun, 8 Mar 2020 20:00:45 -0400
Subject: [PATCH] Use svelte:window to bind winWidth to improve SSR
Removed handler
---
src/components/UIShell/UIShell.svelte | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/src/components/UIShell/UIShell.svelte b/src/components/UIShell/UIShell.svelte
index baa27f76..1cca4d4d 100644
--- a/src/components/UIShell/UIShell.svelte
+++ b/src/components/UIShell/UIShell.svelte
@@ -18,23 +18,13 @@
let isSideNavOpen = undefined;
let winWidth = undefined;
-
- onMount(() => {
- winWidth = window.innerWidth
- window.addEventListener('resize', () => {
- winWidth = window.innerWidth;
+ $: isSideNavOpen = winWidth >= 1056
- if (winWidth >= 1056) {
- isSideNavOpen = true;
- } else {
- isSideNavOpen = false;
- }
- });
- })
-
$: ariaLabel = company + (uiShellAriaLabel || $$props['aria-label'] || platformName);
+
+