All files / src/shared GiveLoadingSpinnerBox.tsx

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

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                6x                         20x                                           20x                            
import { Box, CircularProgressProps, SxProps } from "@mui/material";
import { styled } from "@theme/v2/Provider";
import GiveText from "./Text/GiveText";
import GiveCircularProgress from "./GiveCircularProgress";
import { TMakePalette } from "@theme/v2/theme.builders";
 
type GradientColors = Exclude<keyof TMakePalette["gradient"], "aqua-horizon">;
 
const GiveLoadingSpinnerBox = ({
  sx,
  spinnerProps,
  gradient = "ocean-blue",
  color,
  label,
}: {
  label?: string;
  sx?: SxProps;
  color?: string;
  gradient?: GradientColors;
  spinnerProps?: CircularProgressProps;
}) => {
  return (
    <StyledBox gap="16px" sx={sx}>
      <GiveCircularProgress
        color={color}
        gradient={gradient}
        {...spinnerProps}
      />
      {!!label && (
        <GiveText
          variant="bodyS"
          color="primary"
          lineHeight="20px"
          textAlign="center"
          paddingX={"16px"}
        >
          {label}
        </GiveText>
      )}
    </StyledBox>
  );
};
 
const StyledBox = styled(Box)(({ theme }) => ({
  display: "flex",
  flexDirection: "column",
  justifyContent: "space-between",
  alignItems: "center",
  width: "233px",
  height: "136px",
  backgroundColor: theme.palette.surface?.["primary-transparent"],
  backdropFilter: "blur(25px)",
  borderRadius: "24px",
  padding: "24px",
}));
 
export default GiveLoadingSpinnerBox;