From e91b96e080ea8dfbef46942527c486e3329fa269 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 14 Jan 2024 01:49:40 +0100 Subject: [PATCH] [core] Simplify server detection (#40471) --- docs/data/joy/getting-started/templates/messages/utils.ts | 8 ++++---- .../getting-started/templates/order-dashboard/utils.ts | 4 ++-- .../getting-started/templates/profile-dashboard/utils.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/data/joy/getting-started/templates/messages/utils.ts b/docs/data/joy/getting-started/templates/messages/utils.ts index ac814adefca930..9cdb2b244b1485 100644 --- a/docs/data/joy/getting-started/templates/messages/utils.ts +++ b/docs/data/joy/getting-started/templates/messages/utils.ts @@ -1,12 +1,12 @@ export function openSidebar() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.body.style.overflow = 'hidden'; document.documentElement.style.setProperty('--SideNavigation-slideIn', '1'); } } export function closeSidebar() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.documentElement.style.removeProperty('--SideNavigation-slideIn'); document.body.style.removeProperty('overflow'); } @@ -26,14 +26,14 @@ export function toggleSidebar() { } export function openMessagesPane() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.body.style.overflow = 'hidden'; document.documentElement.style.setProperty('--MessagesPane-slideIn', '1'); } } export function closeMessagesPane() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.documentElement.style.removeProperty('--MessagesPane-slideIn'); document.body.style.removeProperty('overflow'); } diff --git a/docs/data/joy/getting-started/templates/order-dashboard/utils.ts b/docs/data/joy/getting-started/templates/order-dashboard/utils.ts index 58fdec53e099e7..64c8e860d23d8e 100644 --- a/docs/data/joy/getting-started/templates/order-dashboard/utils.ts +++ b/docs/data/joy/getting-started/templates/order-dashboard/utils.ts @@ -1,12 +1,12 @@ export function openSidebar() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.body.style.overflow = 'hidden'; document.documentElement.style.setProperty('--SideNavigation-slideIn', '1'); } } export function closeSidebar() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.documentElement.style.removeProperty('--SideNavigation-slideIn'); document.body.style.removeProperty('overflow'); } diff --git a/docs/data/joy/getting-started/templates/profile-dashboard/utils.ts b/docs/data/joy/getting-started/templates/profile-dashboard/utils.ts index 58fdec53e099e7..64c8e860d23d8e 100644 --- a/docs/data/joy/getting-started/templates/profile-dashboard/utils.ts +++ b/docs/data/joy/getting-started/templates/profile-dashboard/utils.ts @@ -1,12 +1,12 @@ export function openSidebar() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.body.style.overflow = 'hidden'; document.documentElement.style.setProperty('--SideNavigation-slideIn', '1'); } } export function closeSidebar() { - if (typeof document !== 'undefined') { + if (typeof window !== 'undefined') { document.documentElement.style.removeProperty('--SideNavigation-slideIn'); document.body.style.removeProperty('overflow'); }