Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UTOPIA-1594] - (frontend) Trying to delete a comment Modal pop up does not fully darken background #1800

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions src/frontend/src/components/common/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,67 +126,67 @@ function Header() {
setShowModal(false);
};
return (
<header className="header wrapper">
<div className="banner">
<a tabIndex={0} href="/">
<img
className="logo"
src={BCGovLogo}
alt="Go to the Government of British Columbia website"
/>
</a>
<p>
<b>
Digital Privacy Impact Assessment (DPIA) <span>beta</span>
</b>
</p>
</div>

<div className="message">{message ? <p>{message}</p> : null}</div>

<div data-cy="login" className="d-flex flex-grow-1 flex-row-reverse">
{/* Login CTA */}
{!isAuthenticated() && (
<button
className="bcgovbtn bcgovbtn__secondary--dark"
onClick={() => login()}
>
<div className="d-none d-md-block">Log in with IDIR</div>
<FontAwesomeIcon className="icon" icon={faUser} />
</button>
)}

{/* Sign out Modal */}
<Modal
confirmLabel="Yes, sign out"
cancelLabel="Cancel"
titleText="Sign out confirmation"
show={showModal}
reversed={true}
handleClose={hideModalDialog}
handleCancel={cancelModalDialog}
>
<p className="modal-text">
Are you sure you would like to sign out of the platform? You will be
taken out to the landing page.
<>
<header className="header wrapper">
<div className="banner">
<a tabIndex={0} href="/">
<img
className="logo"
src={BCGovLogo}
alt="Go to the Government of British Columbia website"
/>
</a>
<p>
<b>
Digital Privacy Impact Assessment (DPIA) <span>beta</span>
</b>
</p>
</Modal>

{/* Sign out CTA */}
{isAuthenticated() && (
<button
tabIndex={0}
className="bcgovbtn bcgovbtn__secondary--dark"
onClick={() => showModalDialog()}
>
<div className="d-none d-md-block">Sign Out</div>
<div className="d-md-none">
<FontAwesomeIcon className="icon" icon={faSignOut} />
</div>
</button>
)}
</div>
</header>
</div>

<div className="message">{message ? <p>{message}</p> : null}</div>

<div data-cy="login" className="d-flex flex-grow-1 flex-row-reverse">
{/* Login CTA */}
{!isAuthenticated() && (
<button
className="bcgovbtn bcgovbtn__secondary--dark"
onClick={() => login()}
>
<div className="d-none d-md-block">Log in with IDIR</div>
<FontAwesomeIcon className="icon" icon={faUser} />
</button>
)}
{/* Sign out CTA */}
{isAuthenticated() && (
<button
tabIndex={0}
className="bcgovbtn bcgovbtn__secondary--dark"
onClick={() => showModalDialog()}
>
<div className="d-none d-md-block">Sign Out</div>
<div className="d-md-none">
<FontAwesomeIcon className="icon" icon={faSignOut} />
</div>
</button>
)}
</div>
</header>
{/* Sign out Modal */}
<Modal
confirmLabel="Yes, sign out"
cancelLabel="Cancel"
titleText="Sign out confirmation"
show={showModal}
reversed={true}
handleClose={hideModalDialog}
handleCancel={cancelModalDialog}
>
<p className="modal-text">
Are you sure you would like to sign out of the platform? You will be
taken out to the landing page.
</p>
</Modal>
</>
);
}

Expand Down
10 changes: 5 additions & 5 deletions src/frontend/src/components/common/Modal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useRef } from 'react';
import { IModal } from './interfaces';
import InputText from '../InputText/InputText';
import ReactDOM from 'react-dom';

const Modal = ({
confirmLabel,
Expand Down Expand Up @@ -70,13 +71,11 @@ const Modal = ({
};
}, [handleCancel, modalRefCurrent, show]);

const showHideClassName = show
? 'modal display-block '
: 'modal display-none';
const showHideClassName = show ? 'modal display-block' : 'modal display-none';

const handleFocusSelect = (e: any) => e.target.select();

return (
return ReactDOM.createPortal(
<div className={showHideClassName} tabIndex={0} ref={modalRef}>
<section className="modal-main">
<h3 className="modal-title">{titleText}</h3>
Expand Down Expand Up @@ -120,7 +119,8 @@ const Modal = ({
)}
</div>
</section>
</div>
</div>,
document.body,
);
};

Expand Down
152 changes: 77 additions & 75 deletions src/frontend/src/components/public/PIASubHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,91 +232,93 @@ function PIASubHeader({
};

return (
<div className="subheader-container wrapper">
<h1 className="title">{pia.title ? pia.title : 'New PIA'}</h1>
<div className="other__elements-container">
<div className="mx-1">
<StatusChangeDropDown
pia={pia}
mode={mode}
changeStatusFn={changeStatusFn}
/>
</div>
{lastSaveAlertInfo?.show && !nextStepAction && (
<>
<div className="subheader-container wrapper">
<h1 className="title">{pia.title ? pia.title : 'New PIA'}</h1>
<div className="other__elements-container">
<div className="mx-1">
<Alert
type={lastSaveAlertInfo.type}
message={lastSaveAlertInfo.message}
showInitialIcon={true}
showCloseIcon={false}
<StatusChangeDropDown
pia={pia}
mode={mode}
changeStatusFn={changeStatusFn}
/>
</div>
)}
{showEditButton() && (
<div className="mx-1">
{lastSaveAlertInfo?.show && !nextStepAction && (
<div className="mx-1">
<Alert
type={lastSaveAlertInfo.type}
message={lastSaveAlertInfo.message}
showInitialIcon={true}
showCloseIcon={false}
/>
</div>
)}
{showEditButton() && (
<div className="mx-1">
<button
onClick={onEditClick}
className="mx-1 bcgovbtn bcgovbtn__secondary"
aria-label="Edit Button"
>
Edit
</button>
</div>
)}
<div className="d-flex mx-1">
<button
onClick={onEditClick}
className="mx-1 bcgovbtn bcgovbtn__secondary"
aria-label="Edit Button"
className="mx-2 bcgovbtn bcgovbtn__secondary"
type="button"
data-bs-toggle="dropdown"
aria-expanded={false}
aria-label="More options"
>
Edit
<FontAwesomeIcon icon={faEllipsisH} />
</button>
</div>
)}
<div className="d-flex mx-1">
<button
className="mx-2 bcgovbtn bcgovbtn__secondary"
type="button"
data-bs-toggle="dropdown"
aria-expanded={false}
aria-label="More options"
>
<FontAwesomeIcon icon={faEllipsisH} />
</button>

<ul className="dropdown-menu">
<li role="button">
<a
className={`dropdown-item ${!pia?.id ? 'disabled' : ''}`}
target="_blank"
rel="noopener noreferrer"
href={buildDynamicPath(routes.PIA_PRINT_PREVIEW, {
id: pia.id,
})}
aria-label="Print Preview Link"
>
Print Preview
</a>
</li>
<li role="button">
<ul className="dropdown-menu">
<li role="button">
<a
className={`dropdown-item ${!pia?.id ? 'disabled' : ''}`}
target="_blank"
rel="noopener noreferrer"
href={buildDynamicPath(routes.PIA_PRINT_PREVIEW, {
id: pia.id,
})}
aria-label="Print Preview Link"
>
Print Preview
</a>
</li>
<li role="button">
<button
className={`dropdown-item ${!pia?.id ? 'disabled' : ''}`}
aria-label="Generate access link button"
onClick={() => {
handleGenerateInviteCode();
populateGenerateInviteCodeModal();
setShowModal(true);
}}
>
Generate access link
</button>
</li>
</ul>

{/* Submission button */}
{!nextStepAction && showSubmitButton() && (
<button
className={`dropdown-item ${!pia?.id ? 'disabled' : ''}`}
aria-label="Generate access link button"
onClick={() => {
handleGenerateInviteCode();
populateGenerateInviteCodeModal();
setShowModal(true);
onClick={(e) => {
setAccessCode('');
onSubmitClick(e);
}}
className={`mx-1 bcgovbtn bcgovbtn__primary`}
disabled={disableSubmitButton}
aria-label="Submit Button"
>
Generate access link
{primaryButtonText}
</button>
</li>
</ul>

{/* Submission button */}
{!nextStepAction && showSubmitButton() && (
<button
onClick={(e) => {
setAccessCode('');
onSubmitClick(e);
}}
className={`mx-1 bcgovbtn bcgovbtn__primary`}
disabled={disableSubmitButton}
aria-label="Submit Button"
>
{primaryButtonText}
</button>
)}
)}
</div>
</div>
</div>
<Modal
Expand All @@ -335,7 +337,7 @@ function PIASubHeader({
>
<p className="modal-text">{modalParagraph}</p>
</Modal>
</div>
</>
);
}

Expand Down
23 changes: 11 additions & 12 deletions src/frontend/src/pages/PIAForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,18 @@ const PIAFormPage = () => {
</Collapsible>
</div>
</div>

<Modal
confirmLabel={piaModalConfirmLabel}
cancelLabel={piaModalCancelLabel}
titleText={piaModalTitleText}
show={showPiaModal}
value={piaModalButtonValue}
handleClose={(e) => handleModalClose(e)}
handleCancel={handleModalCancel}
>
<p className="modal-text">{piaModalParagraph}</p>
</Modal>
</div>
<Modal
confirmLabel={piaModalConfirmLabel}
cancelLabel={piaModalCancelLabel}
titleText={piaModalTitleText}
show={showPiaModal}
value={piaModalButtonValue}
handleClose={(e) => handleModalClose(e)}
handleCancel={handleModalCancel}
>
<p className="modal-text">{piaModalParagraph}</p>
</Modal>
</>
);
};
Expand Down
Loading