-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfiramtionModal.tsx
61 lines (57 loc) · 1.46 KB
/
ConfiramtionModal.tsx
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React, { useEffect } from "react";
import styles from "./Modals.module.css";
import { useModal } from "../components/ModalsManager/useModal";
export type ConfirmModalOptions = {
callBack: () => Promise<void>
body: string
}
function ConfiramtionModal() {
const { activeModal, closeModal } = useModal<ConfirmModalOptions>();
const { options } = activeModal;
return (
<div className={styles.confirm_modal_wrapper}>
<div
style={{
display: "flex",
flexDirection: "column",
margin: "1.5rem auto 1rem",
gap: "5px",
maxWidth: "254px",
fontSize: "1.4rem",
}}
>
{options?.body.split("\n").map((part, index) => (
<p
style={{
fontSize: index == 1 ? "1.2rem" : "1.4rem",
color: index == 1 ? "gray" : "white",
}}
key={part}
>
{part}
</p>
))}
</div>
<div className={styles.buttons}>
<button
className={`${styles.yes_button} ${styles.button}`}
onClick={() => {
options?.callBack()
closeModal("confirm");
}}
>
Yes
</button>
<button
className={`${styles.no_button} ${styles.button}`}
onClick={() => {
closeModal("confirm");
}}
>
No
</button>
</div>
</div>
);
}
export default ConfiramtionModal;