diff --git a/packages/insomnia/src/ui/components/modals/common-modal.tsx b/packages/insomnia/src/ui/components/modals/common-modal.tsx new file mode 100644 index 00000000000..9c02b1e419e --- /dev/null +++ b/packages/insomnia/src/ui/components/modals/common-modal.tsx @@ -0,0 +1,61 @@ +import React from 'react'; +import { Button, Dialog, Heading, Modal, ModalOverlay } from 'react-aria-components'; + +interface Props { + title: string; + children: React.ReactNode; + isOpen: boolean; + onOk: () => void; + okText?: string; + onCancel: () => void; + cancelText?: string; + isDismissable?: boolean; +} + +export const CommonModal = ({ isOpen, title, cancelText, onCancel, okText, children, onOk, isDismissable = false }: Props) => { + return ( + { + !isOpen && onCancel?.(); + }} + className="w-full h-[--visual-viewport-height] fixed z-10 top-0 left-0 flex items-start justify-center bg-black/30" + > + { + !isOpen && onCancel?.(); + }} + isDismissable={isDismissable} + className="flex flex-col max-w-4xl w-full rounded-md border border-solid border-[--hl-sm] p-[--padding-lg] m-[--padding-lg] max-h-full bg-[--color-bg] text-[--color-font]" + > + + <> + + {title} + +
+ {children} +
+
+ + +
+ +
+
+
+ ); +};