import { useState } from "react";
import { Box, Button, Modal } from "@mui/material";
import { styleDefault } from "@/mui";
import CloseModalD from "@/components/icons/CloseModalD";

function ModalDeleteComment({ loading }) {
  const [open, setOpen] = useState(false);
  const handleOpen = () => setOpen(true);
  const handleClose = () => setOpen(false);

  return (
    <div>
      {/* Button Modal */}
      <Button
        className={` ${!loading && "!border-[#828DE0]"} !rounded-[4px] !py-[6px] md:!py-[7px] lg:!py-[8px] !px-[12px] `}
        disabled={loading}
        onClick={handleOpen}
        variant="outlined"
      >
        لغو کردن نوبت
      </Button>
      {/* Content Modal */}
      <Modal open={open} onClose={handleClose}>
        <Box
          sx={styleDefault}
          className="!w-fit !min-w-[328px] md:!w-fit md:!min-w-[552px] !py-[20px] !px-[24px]"
        >
          <div className="flex items-center justify-between w-full">
            <p className="text-[#3B3B3B] text-[14px] sm:text-[16px] md:text-[18px] lg:text-[20px] font-medium">
              لغو نوبت
            </p>
            <Button onClick={handleClose} className="!p-1" variant="text">
              <CloseModalD />
            </Button>
          </div>
          <span className="block h-px w-full bg-[#EFEFEF] my-[12px] md:my-[14px] lg:my-[16px]"></span>
          <p className="text-[#525252] text-[12px] md:text-[14px] lg:text-[16px] font-normal">
            آیا از لغو کردن نوبت مطمئن هستید؟
          </p>
          <div className="flex items-center justify-end gap-[16px] mt-[12px]">
            <Button
              variant="outlined"
              onClick={handleClose}
              className="!py-[4px] md:!py-[6px] lg:!py-[8px] !px-[8px] md:!px-[12px] lg:!px-[16px] !rounded-[4px] !border-[#828DE0] !text-[#828DE0] !text-[16px] !font-medium"
            >
              انصراف
            </Button>
            <Button
              variant="contained"
              onClick={handleClose}
              className="!py-[4px] md:!py-[6px] lg:!py-[8px] !px-[8px] md:!px-[12px] lg:!px-[16px] !rounded-[4px] !text-[#EFEFEF] !text-[16px] !font-medium"
            >
              لغو نوبت
            </Button>
          </div>
        </Box>
      </Modal>
    </div>
  );
}

export default ModalDeleteComment;
