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 | 20c3aff106089ad9dfe83b01f7447b676aa43021 (patch) | |
| tree | 2d3bb57665686c7d95bcd1b14a6b8b82908aa55c /FrontEnd/src/app/views/common/ConfirmDialog.tsx | |
| parent | db5fed82162c944ee2631297ed99ad4460fd0f07 (diff) | |
| parent | 9389d2cdadb476310d306c5e1baabca4a6101212 (diff) | |
| download | timeline-20c3aff106089ad9dfe83b01f7447b676aa43021.tar.gz timeline-20c3aff106089ad9dfe83b01f7447b676aa43021.tar.bz2 timeline-20c3aff106089ad9dfe83b01f7447b676aa43021.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; |
