All files / src/sections/PayBuilder/LaunchStep/PublicURLShare AdditionalButtons.tsx

100% Statements 8/8
100% Branches 0/0
100% Functions 4/4
100% Lines 8/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          63x             17x 1x           17x     63x                         18x   2x             18x    
import NiceModal from "@ebay/nice-modal-react";
import { Box } from "@mui/material";
import { ReactNode } from "react";
import { EMBED_MODAL } from "modals/modal_names";
 
export const ThreadsShareButton = ({
  url,
  children,
}: {
  url: string;
  children: ReactNode;
}) => {
  const onClick = () => {
    window.open(
      `https://threads.net/intent/post?text=${url}`,
      "_blank",
      "noopener",
    );
  };
  return <Box onClick={onClick}>{children}</Box>;
};
 
export const EmbedShareButton = ({
  url,
  children,
  productId,
  type,
  handleClose,
}: {
  url: string;
  children: ReactNode;
  productId: string;
  type: string;
  handleClose?: () => void;
}) => {
  const onClick = () => {
    // onClick
    NiceModal.show(EMBED_MODAL, {
      open: true,
      productId: productId,
      type: type,
      handleClose,
    });
  };
  return <Box onClick={onClick}>{children}</Box>;
};