All files / src/components/Layout LayoutV2.tsx

85.71% Statements 6/7
20% Branches 1/5
75% Functions 3/4
85.71% Lines 6/7

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                  16x 16x               16x 324x   321x                   321x                    
import React from "react";
import { Box, Stack, BoxProps, StackProps } from "@mui/material";
import { CustomStyleProps } from "@customTypes/style.types";
import { styled } from "theme/v2/Provider";
import { useBannerOffset } from "@hooks/common/useBannerOffset";
import { MASQUERADE_SNACKBAR_HEIGHT } from "@components/Merchants/Masquerade/constants";
 
interface StyledLayoutProps extends BoxProps, CustomStyleProps {}
 
const Layout = styled<React.FC<StyledLayoutProps>>(Box, {
  shouldForwardProp: (prop) => prop !== "isMasqueradeMode",
})(({ isMasqueradeMode = false, winHeight }) => ({
  display: "flex",
  minHeight: winHeight,
  width: "100%",
  paddingTop: isMasqueradeMode ? MASQUERADE_SNACKBAR_HEIGHT + "px" : "0",
}));
 
export const PortalRootContainerV2: React.FC<StackProps> = styled((props) => {
  const bannerOffset = useBannerOffset();
 
  return (
    <Stack
      sx={{
        "@media (max-width: 600px)": {
          paddingTop: bannerOffset ? `${bannerOffset + 64}px` : "64px",
        },
      }}
      {...props}
    />
  );
})(({ theme }) => ({
  flexDirection: "column",
  flexGrow: 1,
  [theme.breakpoints.down("sm")]: {
    gap: "0px !important",
    padding: 0,
  },
}));
 
export default Layout;