All files / src/components/Layout Layout.tsx

100% Statements 7/7
71.42% Branches 5/7
100% Functions 4/4
100% Lines 7/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 43 44 45 46 47 48 49                  10x   28x 6x             10x 323x   322x                               322x                    
import React from "react";
import { Box, Stack, styled, BoxProps, StackProps } from "@mui/material";
import { CustomStyleProps } from "@customTypes/style.types";
import useMasqueradeReducer from "@hooks/Reducers/useMasqueradeReducer";
 
interface StyledLayoutProps extends BoxProps, CustomStyleProps {
  masqueradeOffset?: number;
}
 
const Layout = styled<React.FC<StyledLayoutProps>>(Box, {
  shouldForwardProp: (prop) =>
    prop !== "masqueradeOffset" && prop !== "winHeight",
})(({ masqueradeOffset = 0, winHeight }) => ({
  display: "flex",
  minHeight: winHeight,
  width: "100%",
  paddingTop: `${masqueradeOffset}px`,
}));
 
export const PortalRootContainer: React.FC<StackProps> = styled((props) => {
  const { isMasqueradeMode, masqueradeOffset } = useMasqueradeReducer();
 
  return (
    <Stack
      sx={{
        ...(isMasqueradeMode && {
          paddingBottom: "16px",
        }),
        "@media (max-width: 600px)": {
          ...(isMasqueradeMode && {
            paddingTop: `${masqueradeOffset}px`,
            paddingBottom: 0,
          }),
        },
      }}
      {...props}
    />
  );
})(({ theme }) => ({
  flexDirection: "column",
  flexGrow: 1,
  [theme.breakpoints.down("sm")]: {
    gap: "40px !important",
    padding: 0,
  },
}));
 
export default Layout;