|
@@ -8,6 +8,12 @@ type ConfirmModalProps = {
|
|
|
warningMessage: string;
|
|
warningMessage: string;
|
|
|
supplymentaryMessage: string | null;
|
|
supplymentaryMessage: string | null;
|
|
|
confirmButtonTitle: string;
|
|
confirmButtonTitle: string;
|
|
|
|
|
+ // Optional overrides; defaults keep the original "Warning" appearance so
|
|
|
|
|
+ // existing callers are unaffected.
|
|
|
|
|
+ title?: string;
|
|
|
|
|
+ cancelButtonTitle?: string;
|
|
|
|
|
+ headerClassName?: string;
|
|
|
|
|
+ iconName?: string;
|
|
|
onConfirm?: () => Promise<void>;
|
|
onConfirm?: () => Promise<void>;
|
|
|
onCancel?: () => void;
|
|
onCancel?: () => void;
|
|
|
};
|
|
};
|
|
@@ -17,6 +23,13 @@ export const ConfirmModal: FC<ConfirmModalProps> = (
|
|
|
) => {
|
|
) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ title,
|
|
|
|
|
+ cancelButtonTitle,
|
|
|
|
|
+ headerClassName = 'text-danger',
|
|
|
|
|
+ iconName = 'warning',
|
|
|
|
|
+ } = props;
|
|
|
|
|
+
|
|
|
const onCancel = () => {
|
|
const onCancel = () => {
|
|
|
if (props.onCancel != null) {
|
|
if (props.onCancel != null) {
|
|
|
props.onCancel();
|
|
props.onCancel();
|
|
@@ -31,9 +44,9 @@ export const ConfirmModal: FC<ConfirmModalProps> = (
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Modal isOpen={props.isModalOpen} toggle={onCancel}>
|
|
<Modal isOpen={props.isModalOpen} toggle={onCancel}>
|
|
|
- <ModalHeader tag="h4" toggle={onCancel} className="text-danger">
|
|
|
|
|
- <span className="material-symbols-outlined me-1">warning</span>
|
|
|
|
|
- {t('Warning')}
|
|
|
|
|
|
|
+ <ModalHeader tag="h4" toggle={onCancel} className={headerClassName}>
|
|
|
|
|
+ <span className="material-symbols-outlined me-1">{iconName}</span>
|
|
|
|
|
+ {title ?? t('Warning')}
|
|
|
</ModalHeader>
|
|
</ModalHeader>
|
|
|
<ModalBody>
|
|
<ModalBody>
|
|
|
{props.warningMessage}
|
|
{props.warningMessage}
|
|
@@ -56,7 +69,7 @@ export const ConfirmModal: FC<ConfirmModalProps> = (
|
|
|
className="btn btn-outline-secondary"
|
|
className="btn btn-outline-secondary"
|
|
|
onClick={onCancel}
|
|
onClick={onCancel}
|
|
|
>
|
|
>
|
|
|
- {t('Cancel')}
|
|
|
|
|
|
|
+ {cancelButtonTitle ?? t('Cancel')}
|
|
|
</button>
|
|
</button>
|
|
|
<button
|
|
<button
|
|
|
type="button"
|
|
type="button"
|