MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / WarningModal

Function WarningModal

components/warningModal.tsx:17–124  ·  view source on GitHub ↗
(props: WarningModalData)

Source from the content-addressed store, hash-verified

15};
16
17export default function WarningModal(props: WarningModalData) {
18 const deleteButtonRef = useRef(null);
19
20 // This is so that the title doesn't disappear when the modal is closed
21 const [localTitle, setLocalTitle] = React.useState(props.title);
22 useEffect(() => {
23 if (props.title !== "") setLocalTitle(props.title);
24 else setTimeout(() => setLocalTitle(props.title), 500);
25 }, [props.title]);
26
27 return (
28 <Transition.Root show={props.open} as={Fragment}>
29 <Dialog
30 as="div"
31 className="relative z-50"
32 initialFocus={deleteButtonRef}
33 onClose={props.setOpen}
34 >
35 <Transition.Child
36 as={Fragment}
37 enter="ease-out duration-300"
38 enterFrom="opacity-0"
39 enterTo="opacity-100"
40 leave="ease-in duration-200"
41 leaveFrom="opacity-100"
42 leaveTo="opacity-0"
43 >
44 <div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
45 </Transition.Child>
46
47 <div className="fixed inset-0 z-10 overflow-y-auto">
48 <div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
49 <Transition.Child
50 as={Fragment}
51 enter="ease-out duration-300"
52 enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
53 enterTo="opacity-100 translate-y-0 sm:scale-100"
54 leave="ease-in duration-200"
55 leaveFrom="opacity-100 translate-y-0 sm:scale-100"
56 leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
57 >
58 <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6">
59 <div className="sm:flex sm:items-start">
60 <div
61 className={classNames(
62 "mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full sm:mx-0 sm:h-10 sm:w-10",
63 props.actionColour === "purple"
64 ? "bg-purple-100"
65 : "bg-red-100",
66 )}
67 >
68 <ExclamationTriangleIcon
69 className={classNames(
70 "h-6 w-6",
71 props.actionColour === "purple"
72 ? "text-purple-600"
73 : "text-red-600",
74 )}

Callers

nothing calls this directly

Calls 1

classNamesFunction · 0.90

Tested by

no test coverage detected