diff options
author | crupest <crupest@outlook.com> | 2021-03-18 22:06:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 22:06:18 +0800 |
commit | 9e749b05ad4c20eb69ec4ac6fe8ae83f94ad871a (patch) | |
tree | 19024c5fa955ba8f58504d7961e9964a317d0b49 /FrontEnd/src/app/views/common/ConfirmDialog.tsx | |
parent | 5d41c3aa6d90b2f3892dfe76fd6a0072b76fc4d5 (diff) | |
parent | e46f97d5b1a7573909c88b87e7cf2298e1c5dfa0 (diff) | |
download | timeline-9e749b05ad4c20eb69ec4ac6fe8ae83f94ad871a.tar.gz timeline-9e749b05ad4c20eb69ec4ac6fe8ae83f94ad871a.tar.bz2 timeline-9e749b05ad4c20eb69ec4ac6fe8ae83f94ad871a.zip |
Merge pull request #387 from crupest/markdown-edit
Markdown edit enhancement!
Diffstat (limited to 'FrontEnd/src/app/views/common/ConfirmDialog.tsx')
-rw-r--r-- | FrontEnd/src/app/views/common/ConfirmDialog.tsx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/FrontEnd/src/app/views/common/ConfirmDialog.tsx b/FrontEnd/src/app/views/common/ConfirmDialog.tsx new file mode 100644 index 00000000..72940c51 --- /dev/null +++ b/FrontEnd/src/app/views/common/ConfirmDialog.tsx @@ -0,0 +1,40 @@ +import { convertI18nText, I18nText } from "@/common"; +import React from "react"; +import { Modal, Button } from "react-bootstrap"; +import { useTranslation } from "react-i18next"; + +const ConfirmDialog: React.FC<{ + onClose: () => void; + onConfirm: () => void; + title: I18nText; + body: I18nText; +}> = ({ onClose, onConfirm, title, body }) => { + const { t } = useTranslation(); + + return ( + <Modal onHide={onClose} show centered> + <Modal.Header> + <Modal.Title className="text-danger"> + {convertI18nText(title, t)} + </Modal.Title> + </Modal.Header> + <Modal.Body>{convertI18nText(body, t)}</Modal.Body> + <Modal.Footer> + <Button variant="secondary" onClick={onClose}> + {t("operationDialog.cancel")} + </Button> + <Button + variant="danger" + onClick={() => { + onConfirm(); + onClose(); + }} + > + {t("operationDialog.confirm")} + </Button> + </Modal.Footer> + </Modal> + ); +}; + +export default ConfirmDialog; |