chore: update dialog overflow style (#1872)

This commit is contained in:
boojack
2023-07-01 17:37:43 +08:00
committed by GitHub
parent db8b8f0d58
commit c83fd1de38
2 changed files with 2 additions and 7 deletions

View File

@ -25,7 +25,6 @@ const BaseDialog: React.FC<Props> = (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: 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<T extends DialogProps>(
hide: () => {
tempDiv.firstElementChild?.classList.remove("showup");
tempDiv.firstElementChild?.classList.add("showoff");
document.body.classList.remove("overflow-hidden");
},
};