-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(refactor) Refactor registration form cancel modal to match conventio…
…ns (#1294) This PR refactors the registration form's cancel modal to match new modal naming and registration conventions. Modals are now registered in the routes registry file under the `modals`. The naming convention has also changed - modals now use the `*.modal.tsx` suffix. I've also amended the modal to use Carbon's ModalBody, ModalHeader, and ModalFooter components instead of using divs with custom classes. Finally, I've amended the modal title and content to align with other confirmation modals in O3.
- Loading branch information
1 parent
0d8c01e
commit f21abc4
Showing
7 changed files
with
46 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
packages/esm-patient-registration-app/src/widgets/cancel-patient-edit.component.tsx
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
packages/esm-patient-registration-app/src/widgets/cancel-patient-edit.modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Button, ModalBody, ModalFooter, ModalHeader } from '@carbon/react'; | ||
|
||
interface CancelPatientEditPropsModal { | ||
close(): void; | ||
onConfirm(): void; | ||
} | ||
|
||
const CancelPatientEditModal: React.FC<CancelPatientEditPropsModal> = ({ close, onConfirm }) => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<> | ||
<ModalHeader | ||
closeModal={close} | ||
title={t('confirmDiscardChangesTitle', 'Are you sure you want to discard these changes?')} | ||
/> | ||
<ModalBody> | ||
<p>{t('confirmDiscardChangesBody', 'Your unsaved changes will be lost if you proceed to discard the form')}.</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button kind="secondary" onClick={close}> | ||
{t('cancel', 'Cancel')} | ||
</Button> | ||
<Button kind="danger" onClick={onConfirm}> | ||
{t('discard', 'Discard')} | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
); | ||
}; | ||
|
||
export default CancelPatientEditModal; |
5 changes: 2 additions & 3 deletions
5
packages/esm-patient-registration-app/src/widgets/cancel-patient-edit.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters