Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

106 righe
3.0 KiB

  1. "use client";
  2. import React, { useCallback, useMemo, useState } from "react";
  3. import Button from "@mui/material/Button";
  4. import { Card, Modal, Stack, Typography } from "@mui/material";
  5. import { useTranslation } from "react-i18next";
  6. import { Add } from "@mui/icons-material";
  7. import Check from "@mui/icons-material/Check";
  8. import Close from "@mui/icons-material/Close";
  9. import { TSMS_BUTTON_THEME } from "@/theme/colorConst";
  10. import { ThemeProvider } from "@emotion/react";
  11. interface Props {
  12. isOpen: boolean;
  13. onConfirm: (data: any) => void;
  14. onCancel: (data: any | null) => void;
  15. }
  16. const ConfirmModal: React.FC<Props> = ({ ...props }) => {
  17. const { t } = useTranslation();
  18. return (
  19. <>
  20. <Modal open={props.isOpen} onClose={props.onCancel}>
  21. <Card
  22. style={{
  23. flex: 10,
  24. marginBottom: "20px",
  25. width: "auto",
  26. minWidth: "400px",
  27. minHeight: "200px",
  28. position: "fixed",
  29. top: "50%",
  30. left: "50%",
  31. transform: "translate(-50%, -50%)",
  32. }}
  33. >
  34. <>
  35. <Typography
  36. variant="h5"
  37. id="modal-title"
  38. sx={{
  39. flex: 1,
  40. ml: 4,
  41. mt: 2,
  42. }}
  43. >
  44. {t("Confirm")}
  45. </Typography>
  46. <>
  47. <Typography
  48. variant="h6"
  49. id="modal-title"
  50. sx={{
  51. flex: 1,
  52. mt: 4,
  53. justifyContent: "center",
  54. textAlign: "center",
  55. }}
  56. >
  57. {t("Are You Sure")}
  58. </Typography>
  59. </>
  60. {/* <ThemeProvider theme={TSMS_BUTTON_THEME}> */}
  61. <Stack direction="row">
  62. <Button
  63. variant="contained"
  64. endIcon={<Check />}
  65. sx={{
  66. flex: 1,
  67. ml: 5,
  68. mr: 2,
  69. mt: 4,
  70. justifyContent: "space-between",
  71. }}
  72. onClick={props.onConfirm}
  73. // LinkComponent={Link}
  74. // href="/settings/department/new"
  75. >
  76. Proceed
  77. </Button>
  78. <Button
  79. variant="contained"
  80. startIcon={<Close />}
  81. sx={{
  82. flex: 1,
  83. mr: 5,
  84. mt: 4,
  85. justifyContent: "space-between",
  86. }}
  87. color="warning"
  88. onClick={props.onCancel}
  89. // LinkComponent={Link}
  90. // href="/settings/department/new"
  91. >
  92. Cancel
  93. </Button>
  94. </Stack>
  95. {/* </ThemeProvider> */}
  96. </>
  97. </Card>
  98. </Modal>
  99. </>
  100. );
  101. };
  102. export default ConfirmModal;