All files / src/sections/PayBuilder/Forms/Styling ADBStylerLink.tsx

100% Statements 10/10
100% Branches 0/0
100% Functions 2/2
100% Lines 10/10

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                46x 3x 3x 3x 3x 3x 3x   3x 1x                       3x                                                                              
import { Stack } from "@mui/material";
import { ArrowUpRightIcon } from "@phosphor-icons/react";
import { usePayBuilderForm } from "@sections/PayBuilder/provider/PayBuilderFormProvider";
import GiveButton from "@shared/Button/GiveButton";
import GiveText from "@shared/Text/GiveText";
import { useAppTheme } from "@theme/v2/Provider";
import { useLocation, useNavigate } from "react-router-dom";
 
const ADBStylerLink = () => {
  const { palette } = useAppTheme();
  const { methods } = usePayBuilderForm();
  const navigate = useNavigate();
  const values = methods.watch();
  const location = useLocation();
  const productId = location.state?.id;
 
  const handleOpenADB = () => {
    navigate("/merchant/new-advanced-builder", {
      state: {
        productId,
        productTitle: values.About.heading,
        description: values.About.description,
        campaign: "standard",
        imageURL: values.About.selectedImage,
        position: values.About.assetPosition,
        paymentLogoURL: values.Style.logo,
      },
    });
  };
  return (
    <Stack gap={2} py={2}>
      <GiveText
        fontSize="18px"
        sx={{
          fontWeight: 400,
          color: palette.primitive?.neutral[90],
        }}
      >
        Edit in the Advanced Builder
      </GiveText>
      <GiveText
        fontSize="14px"
        sx={{
          color: palette.primitive?.neutral[60],
        }}
      >
        You can make further customizations and add more content to your page
        with our Pro Toolbox
      </GiveText>
      <GiveButton
        label="Open Advanced Builder"
        endIcon={<ArrowUpRightIcon />}
        onClick={handleOpenADB}
        sx={{
          backgroundColor: palette.primitive?.transparent["darken-5"],
          borderRadius: "40px",
          border: "none",
          color: palette.primitive?.neutral[90],
          "&:hover": {
            color: "initial",
          },
        }}
      />
    </Stack>
  );
};
 
export default ADBStylerLink;