ToolJet/frontend/src/HomePage/Modal.jsx
Anantshree Chandola 03e3fd950b
New Improved App creation flow (#7209)
* App creation flow

* Add separate footer and divider

* added create app dto, updated tests

* update test

* Update server/src/dto/app-create.dto.ts

Co-authored-by: Midhun G S <gsmithun4@gmail.com>

* Update server/src/dto/app-create.dto.ts

Co-authored-by: Midhun G S <gsmithun4@gmail.com>

* updates

* Removed comments

* small updates

* rename app flow

* Import App, Create App From Template, Clone App (BE+FE)

* Edit app updates

* remove comments

* updates

* updates

* styling updates

* handle spaces in app name

* update

* styling updates

* Update permissions

* updates

* don't show toast failure message

* Update frontend/src/Editor/Header/EditAppName.jsx

Co-authored-by: Muhsin Shah C P  <muhsinshah21@gmail.com>

* styling updates

* Update server/src/controllers/app_import_export.controller.ts

Co-authored-by: Muhsin Shah C P  <muhsinshah21@gmail.com>

* remove comments

* remove comments and small corrections

* removed logs and deleted unwanted files

* correct lint error

* resolve failing tests + handled trimmed app names

* resolve failing tests + handle trimmed app names

* updates

* duplicate imports removed

* updates

* Rebase corrections and updates

* update

* resolve failing e2e test

* fix error

* fix

* length fix

* fix

---------

Co-authored-by: Midhun G S <gsmithun4@gmail.com>
Co-authored-by: Muhsin Shah C P <muhsinshah21@gmail.com>
2023-10-17 13:18:18 +05:30

42 lines
1.4 KiB
JavaScript

import React from 'react';
import { default as BootstrapModal } from 'react-bootstrap/Modal';
export default function Modal({ title, show, closeModal, customClassName, children, footerContent = null }) {
const darkMode = localStorage.getItem('darkMode') === 'true';
const modalFooter = footerContent ? (
<BootstrapModal.Footer className={`modal-divider ${darkMode ? 'dark-theme-modal-divider' : ''}`}>
{footerContent}
</BootstrapModal.Footer>
) : null;
return (
<BootstrapModal
onHide={() => closeModal(false)}
contentClassName={`home-modal-component animation-fade${customClassName ? ` ${customClassName}` : ''} ${
darkMode && 'dark-theme'
}`}
show={show}
size="sm"
backdrop={true}
keyboard={true}
enforceFocus={false}
animation={false}
onEscapeKeyDown={() => closeModal()}
centered
data-cy={'modal-component'}
>
<BootstrapModal.Header>
<BootstrapModal.Title data-cy={`${title.toLowerCase().replace(/\s+/g, '-')}-title`}>
{title}
</BootstrapModal.Title>
<button
className="btn-close"
aria-label="Close"
onClick={() => closeModal()}
data-cy="modal-close-button"
></button>
</BootstrapModal.Header>
<BootstrapModal.Body>{children}</BootstrapModal.Body>
{modalFooter ? modalFooter : <></>}
</BootstrapModal>
);
}