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

psp-8185 remove closebutton generic modal prop - show custom pims clo… #4026

Merged
merged 4 commits into from
May 21, 2024
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
13 changes: 4 additions & 9 deletions source/frontend/src/components/common/GenericModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ export interface ModalContent {
headerIcon?: string | React.ReactNode;
/** Optional message to display - no default. */
message?: string | React.ReactNode;
/** optional override to control the x button in the top right of the modal. Default is to show. */
closeButton?: boolean;
/** provide the size of the modal, default width is 50.0rem */
modalSize?: ModalSize;
variant: 'info' | 'warning' | 'error';
Expand Down Expand Up @@ -117,7 +115,6 @@ export const GenericModal = (props: Omit<BsModalProps, 'onHide'> & ModalProps) =
okButtonHref,
cancelButtonVariant,
cancelButtonText,
closeButton,
hideFooter,
modalSize = ModalSize.MEDIUM,
variant,
Expand Down Expand Up @@ -211,19 +208,17 @@ export const GenericModal = (props: Omit<BsModalProps, 'onHide'> & ModalProps) =
onHide={noop}
className={getModalClass()}
>
<Modal.Header closeButton={closeButton} onHide={close}>
<Modal.Header onHide={close}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This closebutton actually causes a few problems.

Clicking this close button does not fire our close event.
the styling is hard to see and does not use one of our approved icons.

{headerIconValue && (
<>
<div className="header-icon">{headerIconValue}</div>
<Spacing8 />
</>
)}
<Modal.Title>{title}</Modal.Title>
{!closeButton && (
<div className="modal-close-btn">
<FaWindowClose size={24} onClick={close} />
</div>
)}
<div className="modal-close-btn">
<FaWindowClose size={24} onClick={close} />
</div>
</Modal.Header>

<Modal.Body style={{ whiteSpace: 'pre-line' }}>{message}</Modal.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const DocumentUploadContainer = forwardRef<

const { setDisplayModal } = useModalContext({
...deleteModalProps,
closeButton: false,
handleOk: () => {
handleCancelConfirm();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ export const DepositsContainer: React.FunctionComponent<
message={`Are you sure you want to remove the deposit?`}
handleOk={() => onDeleteDepositConfirmed()}
okButtonText="OK"
closeButton
setDisplay={setDeleteModalWarning}
/>
<GenericModal
Expand All @@ -249,7 +248,6 @@ export const DepositsContainer: React.FunctionComponent<
message={`Are you sure you want to remove this deposit return?`}
handleOk={() => onDeleteDepositReturnConfirmed()}
okButtonText="OK"
closeButton
setDisplay={setDeleteReturnModalWarning}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,23 @@ exports[`NoteContainer component > renders as expected 1`] = `
>
Notes
</div>
<button
class="close"
type="button"
<div
class="modal-close-btn"
>
<span
aria-hidden="true"
<svg
fill="currentColor"
height="24"
stroke="currentColor"
stroke-width="0"
viewBox="0 0 512 512"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
×
</span>
<span
class="sr-only"
>
Close
</span>
</button>
<path
d="M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-83.6 290.5c4.8 4.8 4.8 12.6 0 17.4l-40.5 40.5c-4.8 4.8-12.6 4.8-17.4 0L256 313.3l-66.5 67.1c-4.8 4.8-12.6 4.8-17.4 0l-40.5-40.5c-4.8-4.8-4.8-12.6 0-17.4l67.1-66.5-67.1-66.5c-4.8-4.8-4.8-12.6 0-17.4l40.5-40.5c4.8-4.8 12.6-4.8 17.4 0l66.5 67.1 66.5-67.1c4.8-4.8 12.6-4.8 17.4 0l40.5 40.5c4.8 4.8 4.8 12.6 0 17.4L313.3 256l67.1 66.5z"
/>
</svg>
</div>
</div>
<div
class="modal-body"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export const NoteDetailsFormModal: React.FC<
okButtonText="Close"
handleOk={onCloseClick}
handleCancel={onCloseClick}
closeButton
></StyledModal>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,23 @@ exports[`NoteDetailsFormModal component > renders as expected 1`] = `
>
Notes
</div>
<button
class="close"
type="button"
<div
class="modal-close-btn"
>
<span
aria-hidden="true"
>
×
</span>
<span
class="sr-only"
<svg
fill="currentColor"
height="24"
stroke="currentColor"
stroke-width="0"
viewBox="0 0 512 512"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
Close
</span>
</button>
<path
d="M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-83.6 290.5c4.8 4.8 4.8 12.6 0 17.4l-40.5 40.5c-4.8 4.8-12.6 4.8-17.4 0L256 313.3l-66.5 67.1c-4.8 4.8-12.6 4.8-17.4 0l-40.5-40.5c-4.8-4.8-4.8-12.6 0-17.4l67.1-66.5-67.1-66.5c-4.8-4.8-4.8-12.6 0-17.4l40.5-40.5c4.8-4.8 12.6-4.8 17.4 0l66.5 67.1 66.5-67.1c4.8-4.8 12.6-4.8 17.4 0l40.5 40.5c4.8 4.8 4.8 12.6 0 17.4L313.3 256l67.1 66.5z"
/>
</svg>
</div>
</div>
<div
class="modal-body"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ exports[`Note Results Table > matches snapshot 1`] = `
class="th"
colspan="1"
role="columnheader"
style="box-sizing: border-box; flex: 10 0 auto; min-width: 30px; width: 10px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
style="box-sizing: border-box; flex: 20 0 auto; min-width: 30px; width: 20px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
>
<div
class="sortable-column"
Expand Down Expand Up @@ -392,7 +392,7 @@ exports[`Note Results Table > matches snapshot 1`] = `
<div
class="td"
role="cell"
style="box-sizing: border-box; flex: 10 0 auto; min-width: 30px; width: 10px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
style="box-sizing: border-box; flex: 20 0 auto; min-width: 30px; width: 20px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
title=""
>
<div
Expand Down Expand Up @@ -460,7 +460,7 @@ exports[`Note Results Table > matches snapshot 1`] = `
<div
class="td"
role="cell"
style="box-sizing: border-box; flex: 10 0 auto; min-width: 30px; width: 10px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
style="box-sizing: border-box; flex: 20 0 auto; min-width: 30px; width: 20px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
title=""
>
<div
Expand Down Expand Up @@ -528,7 +528,7 @@ exports[`Note Results Table > matches snapshot 1`] = `
<div
class="td"
role="cell"
style="box-sizing: border-box; flex: 10 0 auto; min-width: 30px; width: 10px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
style="box-sizing: border-box; flex: 20 0 auto; min-width: 30px; width: 20px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
title=""
>
<div
Expand Down Expand Up @@ -596,7 +596,7 @@ exports[`Note Results Table > matches snapshot 1`] = `
<div
class="td"
role="cell"
style="box-sizing: border-box; flex: 10 0 auto; min-width: 30px; width: 10px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
style="box-sizing: border-box; flex: 20 0 auto; min-width: 30px; width: 20px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
title=""
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export function createTableColumns(
accessor: 'controls' as any, // this column is not part of the data model
align: 'center',
sortable: false,
width: 10,
maxWidth: 10,
width: 20,
maxWidth: 20,
Cell: (cellProps: CellProps<ApiGen_Concepts_Note>) => {
const { hasClaim } = useKeycloakWrapper();

Expand All @@ -57,6 +57,7 @@ export function createTableColumns(
title="View Note"
variant="light"
onClick={() => onShowDetails(cellProps.row.original)}
className="pl-0"
>
<ImFileText2 size="2rem" />
</StyledIconButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ exports[`Note List View > renders as expected 1`] = `
class="th"
colspan="1"
role="columnheader"
style="box-sizing: border-box; flex: 10 0 auto; min-width: 30px; width: 10px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
style="box-sizing: border-box; flex: 20 0 auto; min-width: 30px; width: 20px; justify-content: center; text-align: center; flex-wrap: wrap; align-items: center; display: flex;"
>
<div
class="sortable-column"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export const UpdateNoteFormModal = React.forwardRef<
display={isOpened}
title="Notes"
message={loading ? spinner : <FormBody {...formikProps}></FormBody>}
closeButton
okButtonText="Save"
cancelButtonText="Cancel"
handleOk={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,21 +303,23 @@ exports[`UpdateNoteContainer component > renders as expected 1`] = `
>
Notes
</div>
<button
class="close"
type="button"
<div
class="modal-close-btn"
>
<span
aria-hidden="true"
<svg
fill="currentColor"
height="24"
stroke="currentColor"
stroke-width="0"
viewBox="0 0 512 512"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
×
</span>
<span
class="sr-only"
>
Close
</span>
</button>
<path
d="M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-83.6 290.5c4.8 4.8 4.8 12.6 0 17.4l-40.5 40.5c-4.8 4.8-12.6 4.8-17.4 0L256 313.3l-66.5 67.1c-4.8 4.8-12.6 4.8-17.4 0l-40.5-40.5c-4.8-4.8-4.8-12.6 0-17.4l67.1-66.5-67.1-66.5c-4.8-4.8-4.8-12.6 0-17.4l40.5-40.5c4.8-4.8 12.6-4.8 17.4 0l66.5 67.1 66.5-67.1c4.8-4.8 12.6-4.8 17.4 0l40.5 40.5c4.8 4.8 4.8 12.6 0 17.4L313.3 256l67.1 66.5z"
/>
</svg>
</div>
</div>
<div
class="modal-body"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,23 @@ exports[`UpdateNoteFormModal component > renders as expected 1`] = `
>
Notes
</div>
<button
class="close"
type="button"
<div
class="modal-close-btn"
>
<span
aria-hidden="true"
<svg
fill="currentColor"
height="24"
stroke="currentColor"
stroke-width="0"
viewBox="0 0 512 512"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
×
</span>
<span
class="sr-only"
>
Close
</span>
</button>
<path
d="M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-83.6 290.5c4.8 4.8 4.8 12.6 0 17.4l-40.5 40.5c-4.8 4.8-12.6 4.8-17.4 0L256 313.3l-66.5 67.1c-4.8 4.8-12.6 4.8-17.4 0l-40.5-40.5c-4.8-4.8-4.8-12.6 0-17.4l67.1-66.5-67.1-66.5c-4.8-4.8-4.8-12.6 0-17.4l40.5-40.5c4.8-4.8 12.6-4.8 17.4 0l66.5 67.1 66.5-67.1c4.8-4.8 12.6-4.8 17.4 0l40.5 40.5c4.8 4.8 4.8 12.6 0 17.4L313.3 256l67.1 66.5z"
/>
</svg>
</div>
</div>
<div
class="modal-body"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const SideProjectContainer: React.FunctionComponent<ISideProjectContainer
title: 'Warning',
message: 'There is no data for the input parameters you entered.',
okButtonText: 'Close',
closeButton: true,
handleOk: () => setDisplayModal(false),
});
setDisplayModal(true);
Expand All @@ -75,7 +74,6 @@ export const SideProjectContainer: React.FunctionComponent<ISideProjectContainer
title: 'Warning',
message: 'There is no data for the input parameters you entered.',
okButtonText: 'Close',
closeButton: true,
handleOk: () => setDisplayModal(false),
});
setDisplayModal(true);
Expand Down
Loading