blob: 249a3bf60f03a57f51ba354a52a668f14bb10223 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import React, { useState } from 'react';
import MessageDialog from "../components/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;
|