From c83fd1de38885f0f7587ddd7fed81ff500f260e8 Mon Sep 17 00:00:00 2001 From: boojack Date: Sat, 1 Jul 2023 17:37:43 +0800 Subject: [PATCH] chore: update dialog overflow style (#1872) --- web/src/components/Dialog/BaseDialog.tsx | 5 ----- web/src/css/global.css | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/web/src/components/Dialog/BaseDialog.tsx b/web/src/components/Dialog/BaseDialog.tsx index a8c95670..6ca7087f 100644 --- a/web/src/components/Dialog/BaseDialog.tsx +++ b/web/src/components/Dialog/BaseDialog.tsx @@ -25,7 +25,6 @@ const BaseDialog: React.FC = (props: Props) => { const dialogIndex = dialogStore.state.dialogStack.findIndex((item) => item === dialogName); useEffect(() => { - document.body.classList.add("overflow-hidden"); dialogStore.pushDialogStack(dialogName); const handleKeyDown = (event: KeyboardEvent) => { if (event.code === "Escape") { @@ -40,9 +39,6 @@ const BaseDialog: React.FC = (props: Props) => { return () => { document.body.removeEventListener("keydown", handleKeyDown); dialogStore.removeDialog(dialogName); - if (dialogStore.state.dialogStack.length === 0) { - document.body.classList.remove("overflow-hidden"); - } }; }, []); @@ -92,7 +88,6 @@ export function generateDialog( hide: () => { tempDiv.firstElementChild?.classList.remove("showup"); tempDiv.firstElementChild?.classList.add("showoff"); - document.body.classList.remove("overflow-hidden"); }, }; diff --git a/web/src/css/global.css b/web/src/css/global.css index e6812bdf..a29ddc72 100644 --- a/web/src/css/global.css +++ b/web/src/css/global.css @@ -1,11 +1,11 @@ html, body { - @apply text-base w-full h-full dark:bg-zinc-800; + @apply text-base w-full h-full overflow-hidden dark:bg-zinc-800; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans", "Noto Sans CJK SC", "Microsoft YaHei UI", "Microsoft YaHei", "WenQuanYi Micro Hei", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif; } #root { - @apply w-full h-full; + @apply w-full h-full overflow-auto; }