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

80% Statements 4/5
100% Branches 2/2
66.66% Functions 2/3
80% Lines 4/5

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 75 76 77 78 79 80 81          63x                     55x       55x                                                                               375x                                        
import { Popover, Stack } from "@mui/material";
import { Dispatch, SetStateAction } from "react";
import PublicInputShare from "./PublicInputShare";
import type { TButtonsMap } from "./PublicShare.types";
 
const StrictVariant = ({
  ButtonsMap,
  anchorEl,
  setAnchorEl,
  url,
}: {
  ButtonsMap: TButtonsMap;
  anchorEl: HTMLElement | null;
  url: string;
  setAnchorEl: Dispatch<SetStateAction<HTMLElement | null>>;
}) => {
  const handleClose = () => {
    setAnchorEl(null);
  };
 
  return (
    <Popover
      id="anchorEl"
      open={Boolean(anchorEl)}
      anchorEl={anchorEl}
      onClose={handleClose}
      PaperProps={{
        style: {
          borderRadius: "20px",
          boxShadow: "0px 4px 8px rgba(0, 0, 0, 0.1)",
          width: "456px",
          padding: "16px",
        },
      }}
      anchorOrigin={{
        vertical: "bottom",
        horizontal: "right",
      }}
      transformOrigin={{
        vertical: "top",
        horizontal: "right",
      }}
    >
      <Stack>
        <Stack direction="row" alignItems="center" gap={2}>
          <PublicInputShare
            url={url}
            textProps={{
              fontSize: "14px",
              minWidth: "72px",
            }}
          />
        </Stack>
        <Stack
          direction="row"
          flexWrap="wrap"
          pt="16px"
          justifyContent="space-between"
        >
          {ButtonsMap.map((Button, index) => {
            return (
              Button.hidden === false && (
                <Button.Component
                  id={`${Button.id}-share-button`}
                  url={url}
                  key={index}
                  appId=""
                >
                  <Button.Icon />
                </Button.Component>
              )
            );
          })}
        </Stack>
      </Stack>
    </Popover>
  );
};
 
export default StrictVariant;