All files / src/sections/PayBuilder/Forms/Styling/components OptionWrapper.tsx

80% Statements 4/5
100% Branches 2/2
50% Functions 1/2
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        45x 42x 42x   42x                                                    
import { Box } from "@mui/material";
import { usePayBuilderForm } from "@sections/PayBuilder/provider/PayBuilderFormProvider";
import { useAppTheme } from "@theme/v2/Provider";
 
export const OptionWrapper = ({ children, type }: any) => {
  const { methods, parsedValues } = usePayBuilderForm();
  const { palette } = useAppTheme();
 
  return (
    <Box
      onClick={() => {
        methods.setValue("Style.itemLayout", type);
      }}
      gap={2}
      sx={{
        cursor: "pointer",
        maxHeight: "140px",
        display: "flex",
        justifyContent: "center",
        alignItems: "center",
        flexDirection: "column",
        padding: "12px",
        borderRadius: "12px",
        border: `1px solid ${
          parsedValues.itemsLayout === type
            ? palette.border?.active
            : palette.border?.primary
        }`,
      }}
    >
      {children}
    </Box>
  );
};