import React from "react"; import ReactDOM from "react-dom"; import { Button, ButtonGroup } from "@jambonz/ui-kit"; import "./styles.scss"; import { Spinner } from "../spinner"; type ModalProps = { disabled?: boolean; children: React.ReactNode; handleSubmit: (e: React.FormEvent) => void; handleCancel: (e: React.FormEvent) => void; }; type CloseProps = { children: React.ReactNode; handleClose: () => void; }; const portal: Element = document.getElementById("modal")!; export const Modal = ({ disabled, children, handleSubmit, handleCancel, }: ModalProps) => { return ReactDOM.createPortal(
{children}
, portal, ); }; export const ModalForm = ({ disabled, children, handleSubmit, handleCancel, }: ModalProps) => { return ReactDOM.createPortal(
{ e.preventDefault(); handleSubmit(e); }} >
{children}
, portal, ); }; export const ModalClose = ({ children, handleClose }: CloseProps) => { return ReactDOM.createPortal(
e.stopPropagation()} >
e.stopPropagation()} > {children}
, portal, ); }; type LoaderProps = { children: React.ReactNode; }; export const ModalLoader = ({ children }: LoaderProps) => { return ReactDOM.createPortal(
e.stopPropagation()} >
e.stopPropagation()} > {children}
, portal, ); };