revite/src/context/intermediate/Modals.tsx

34 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-06-19 13:46:05 -04:00
import { Screen } from "./Intermediate";
2021-07-05 06:23:23 -04:00
import { ClipboardModal } from "./modals/Clipboard";
2021-06-19 13:46:05 -04:00
import { ErrorModal } from "./modals/Error";
2021-06-19 15:00:30 -04:00
import { InputModal } from "./modals/Input";
2021-07-05 06:23:23 -04:00
import { OnboardingModal } from "./modals/Onboarding";
2021-06-19 15:00:30 -04:00
import { PromptModal } from "./modals/Prompt";
2021-06-19 13:46:05 -04:00
import { SignedOutModal } from "./modals/SignedOut";
export interface Props {
2021-07-05 06:25:20 -04:00
screen: Screen;
openScreen: (id: any) => void;
2021-06-19 13:46:05 -04:00
}
export default function Modals({ screen, openScreen }: Props) {
2021-07-05 06:25:20 -04:00
const onClose = () => openScreen({ id: "none" });
2021-06-19 13:46:05 -04:00
2021-07-05 06:25:20 -04:00
switch (screen.id) {
case "_prompt":
return <PromptModal onClose={onClose} {...screen} />;
case "_input":
return <InputModal onClose={onClose} {...screen} />;
case "error":
return <ErrorModal onClose={onClose} {...screen} />;
case "signed_out":
return <SignedOutModal onClose={onClose} {...screen} />;
case "clipboard":
return <ClipboardModal onClose={onClose} {...screen} />;
case "onboarding":
return <OnboardingModal onClose={onClose} {...screen} />;
}
2021-06-19 13:46:05 -04:00
2021-07-05 06:25:20 -04:00
return null;
2021-06-19 13:46:05 -04:00
}