Modals: Add close animation.

This commit is contained in:
Paul
2021-07-07 22:02:18 +01:00
parent 41567413f2
commit 98ea3e7af7
5 changed files with 43 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
import { isModalClosing } from "../../components/ui/Modal";
import { internalEmit } from "../../lib/eventEmitter";
import { Screen } from "./Intermediate";
import { ClipboardModal } from "./modals/Clipboard";
import { ErrorModal } from "./modals/Error";
@@ -12,7 +14,7 @@ export interface Props {
}
export default function Modals({ screen, openScreen }: Props) {
const onClose = () => openScreen({ id: "none" });
const onClose = () => isModalClosing ? openScreen({ id: "none" }) : internalEmit('Modal', 'close');
switch (screen.id) {
case "_prompt":

View File

@@ -1,4 +1,6 @@
import { useContext } from "preact/hooks";
import { isModalClosing } from "../../components/ui/Modal";
import { internalEmit } from "../../lib/eventEmitter";
import { IntermediateContext, useIntermediate } from "./Intermediate";
import { SpecialInputModal } from "./modals/Input";
@@ -14,7 +16,7 @@ export default function Popovers() {
const { screen } = useContext(IntermediateContext);
const { openScreen } = useIntermediate();
const onClose = () => openScreen({ id: "none" });
const onClose = () => isModalClosing ? openScreen({ id: "none" }) : internalEmit('Modal', 'close');
switch (screen.id) {
case "profile":