From 78f0934815a87573289c8e52af2666ea38c93251 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Tue, 11 Jul 2023 18:45:25 +0800
Subject: Fix dialog typo.

---
 FrontEnd/src/views/common/dialog/ConfirmDialog.tsx | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 FrontEnd/src/views/common/dialog/ConfirmDialog.tsx

(limited to 'FrontEnd/src/views/common/dialog/ConfirmDialog.tsx')

diff --git a/FrontEnd/src/views/common/dialog/ConfirmDialog.tsx b/FrontEnd/src/views/common/dialog/ConfirmDialog.tsx
new file mode 100644
index 00000000..8c2cea5a
--- /dev/null
+++ b/FrontEnd/src/views/common/dialog/ConfirmDialog.tsx
@@ -0,0 +1,43 @@
+import { convertI18nText, I18nText } from "@/common";
+import * as React from "react";
+import { useTranslation } from "react-i18next";
+
+import Button from "../button/Button";
+import Dialog from "./Dialog";
+
+const ConfirmDialog: React.FC<{
+  open: boolean;
+  onClose: () => void;
+  onConfirm: () => void;
+  title: I18nText;
+  body: I18nText;
+}> = ({ open, onClose, onConfirm, title, body }) => {
+  const { t } = useTranslation();
+
+  return (
+    <Dialog onClose={onClose} open={open}>
+      <h3 className="cru-color-danger">{convertI18nText(title, t)}</h3>
+      <hr />
+      <p>{convertI18nText(body, t)}</p>
+      <hr />
+      <div className="cru-dialog-bottom-area">
+        <Button
+          text="operationDialog.cancel"
+          color="secondary"
+          outline
+          onClick={onClose}
+        />
+        <Button
+          text="operationDialog.confirm"
+          color="danger"
+          onClick={() => {
+            onConfirm();
+            onClose();
+          }}
+        />
+      </div>
+    </Dialog>
+  );
+};
+
+export default ConfirmDialog;
-- 
cgit v1.2.3

