All files / src/sections/PayBuilder/LaunchStep/PublicURLShare/EmbedForm EmbedModal.tsx

66.66% Statements 6/9
66.66% Branches 4/6
33.33% Functions 1/3
75% Lines 6/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 62 63 64 65 66 67 68 69 70 71 72 73 74                      1x     6x 6x 6x 6x         6x                                                                                                      
// components
import { ModalTitle } from "@common/Modal/ModalFactory/atoms";
import useNiceModal from "@common/Modal/ModalFactory/hooks/useNiceModal";
import ModalFactory from "@common/Modal/ModalFactory/ModalFactory";
import NiceModal from "@ebay/nice-modal-react";
import { Box } from "@mui/material";
import { ShareProps } from "@sections/Actions/Share/share.types";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import EmbedModalContent from "./EmbedModalContent";
import { capitalizeFirstLetter } from "@utils/index";
 
const EmbedModal = NiceModal.create(
  ({ title, productId, type, handleClose }: ShareProps) => {
    const { onClose, TransitionProps, SlideProps, open, modal } =
      useNiceModal();
    const { isMobileView } = useCustomThemeV2();
    const handleCancel = () => modal.hide();
    const close = () => {
      handleClose?.();
      onClose();
    };
 
    return (
      <ModalFactory
        variant="dialog"
        modalProps={{
          open,
          onClose: close,
          DrawerProps: {
            SlideProps,
            PaperProps: {
              sx: {
                "&.MuiPaper-root": {
                  padding: "unset",
                },
              },
            },
          },
          DialogProps: {
            TransitionProps,
            width: "720px",
            contentContainerSx: {
              // overflowY: "auto",
            },
            PaperProps: {
              "& .MuiPaper-root": {},
            },
            scroll: "paper",
          },
        }}
      >
        <ModalTitle
          title={`Share ${capitalizeFirstLetter(type === "sweepstake" ? "sweepstakes" : type)}`}
          padding="16px"
          onClose={handleCancel}
          textStyles={{ title: { fontSize: 18, lineHeight: "21.6px" } }}
          showDivider
        />
        <Box
          sx={{
            overflowY: "auto",
            overflowX: "hidden",
            padding: isMobileView ? "16px" : "16px 6px 16px 16px",
          }}
        >
          <EmbedModalContent productId={productId} type={type || "product"} />
        </Box>
      </ModalFactory>
    );
  },
);
 
export default EmbedModal;