From 8c8edfc9c8bb1a0fa3d1e02aab576044857f1c95 Mon Sep 17 00:00:00 2001
From: Wolfboy248 <105884620+Wolfboy248@users.noreply.github.com>
Date: Sun, 20 Oct 2024 00:27:38 +0200
Subject: refactor: custom modals

---
 frontend/src/components/UseMessage.tsx | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 frontend/src/components/UseMessage.tsx

(limited to 'frontend/src/components/UseMessage.tsx')

diff --git a/frontend/src/components/UseMessage.tsx b/frontend/src/components/UseMessage.tsx
new file mode 100644
index 0000000..fbd3c82
--- /dev/null
+++ b/frontend/src/components/UseMessage.tsx
@@ -0,0 +1,27 @@
+import React, { useState } from 'react';
+import MessageDialog from "./MessageDialog";
+
+const useMessage = () => {
+    const [isOpen, setIsOpen] = useState(false);
+
+    const [title, setTitle] = useState<string>("");
+    const [subtitle, setSubtitle] = useState<string>("");
+
+    const message = (title: string, subtitle: string) => {
+        setIsOpen(true);
+        setTitle(title);
+        setSubtitle(subtitle);
+    };
+
+    const handleClose = () => {
+        setIsOpen(false);
+    };
+
+    const MessageDialogComponent = isOpen && (
+        <MessageDialog title={title} subtitle={subtitle} onClose={handleClose}></MessageDialog>
+    );
+
+    return { message, MessageDialogComponent };
+}
+
+export default useMessage;
-- 
cgit v1.2.3

