import React from "react"; import PropTypes from "prop-types"; import Loaders from "@appserver/common/components/Loaders"; import Heading from "../../heading"; import { StyledModal, StyledHeader, Content, Dialog, StyledBody, StyledFooter, } from "../styled-modal-dialog"; import CloseButton from "../components/CloseButton"; import ModalBackdrop from "../components/ModalBackdrop"; import Scrollbar from "../../scrollbar"; const Modal = ({ id, style, className, currentDisplayType, withBodyScroll, isLarge, zIndex, autoMaxHeight, autoMaxWidth, onClose, isLoading, header, body, footer, visible, modalSwipeOffset, }) => { const headerComponent = header ? header.props.children : null; const bodyComponent = body ? body.props.children : null; const footerComponent = footer ? footer.props.children : null; return ( e.stopPropagation()} > {isLoading ? (
{currentDisplayType === "modal" ? ( ) : ( )}
) : ( <> {header && ( {headerComponent} )} {body && ( {currentDisplayType === "aside" && withBodyScroll ? ( {bodyComponent} ) : ( bodyComponent )} )} {footer && ( {footerComponent} )} )}
); }; Modal.propTypes = { id: PropTypes.string, className: PropTypes.string, zIndex: PropTypes.number, style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), onClose: PropTypes.func, visible: PropTypes.bool, modalSwipeOffset: PropTypes.number, isLoading: PropTypes.bool, modalLoaderBodyHeight: PropTypes.string, currentDisplayType: PropTypes.oneOf(["auto", "modal", "aside"]), isLarge: PropTypes.bool, header: PropTypes.object, body: PropTypes.object, footer: PropTypes.object, }; export default Modal;