chore: update save button style (#1542)

This commit is contained in:
boojack
2023-04-16 15:47:01 +08:00
committed by GitHub
parent 73b8d1dd99
commit 5f8aae69e4
3 changed files with 6 additions and 2 deletions

View File

@ -25,6 +25,7 @@ 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") {
@ -39,6 +40,9 @@ 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");
}
};
}, []);