From 35026849dfc5e1ea4458252d2a014567151c85b0 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 18 Jun 2024 15:39:50 -0700 Subject: [PATCH] refac: styling --- src/lib/components/chat/Chat.svelte | 4 ++-- src/lib/components/common/Modal.svelte | 16 ++++++++-------- src/lib/components/layout/Sidebar.svelte | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 4c5f54258..4fbd50993 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1321,7 +1321,7 @@
{#if $settings?.backgroundImageUrl ?? null}
{#each $banners.filter( (b) => (b.dismissible ? !JSON.parse(localStorage.getItem('dismissedBannerIds') ?? '[]').includes(b.id) : true) ) as banner} diff --git a/src/lib/components/common/Modal.svelte b/src/lib/components/common/Modal.svelte index 5e94f543c..1cb6b64dc 100644 --- a/src/lib/components/common/Modal.svelte +++ b/src/lib/components/common/Modal.svelte @@ -33,14 +33,14 @@ mounted = true; }); - $: if (mounted) { - if (show) { - window.addEventListener('keydown', handleKeyDown); - document.body.style.overflow = 'hidden'; - } else { - window.removeEventListener('keydown', handleKeyDown); - document.body.style.overflow = 'unset'; - } + $: if (show && modalElement) { + document.body.appendChild(modalElement); + window.addEventListener('keydown', handleKeyDown); + document.body.style.overflow = 'hidden'; + } else if (modalElement) { + document.body.removeChild(modalElement); + window.removeEventListener('keydown', handleKeyDown); + document.body.style.overflow = 'unset'; } diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 873a943c5..0cd6afa28 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -209,7 +209,7 @@ {#if $showSidebar}
{ showSidebar.set(!$showSidebar); }} @@ -221,12 +221,12 @@ id="sidebar" class="h-screen max-h-[100dvh] min-h-screen select-none {$showSidebar ? 'md:relative w-[260px]' - : '-translate-x-[260px] w-[0px]'} bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 md:z-30 top-0 left-0 rounded-r-2xl + : '-translate-x-[260px] w-[0px]'} bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0 rounded-r-2xl " data-state={$showSidebar} >