All files / src/components/Merchants/MerchantPreview/modals/shared/skeletons GivePreviousChecksSectionSkeleton.tsx

100% Statements 7/7
100% Branches 2/2
100% Functions 4/4
100% Lines 5/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 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96          67x                                   67x                   4x   67x                                                     2010x                                                                  
import { Box, Stack, Skeleton } from "@mui/material";
import { styled } from "@theme/v2/Provider";
import TaskCard from "@features/Merchants/MerchantSidePanel/UnderwritingTasks/components/TaskCard";
import { checkoutScrollbarStyles } from "@sections/PayBuilder/Checkout/helpers";
 
const AnimatedSkeletonsContainer = styled(Stack)(() => ({
  "& .MuiSkeleton-root": {
    animation: "none !important",
  },
  "@keyframes skeletonPulse": {
    "0%": {
      opacity: 1,
    },
    "50%": {
      opacity: 0.7,
    },
    "100%": {
      opacity: 1,
    },
  },
  animation: "skeletonPulse 1.5s ease-in-out infinite",
}));
 
const TaskCardScrollContainer = styled(Box)(() => ({
  flex: 1,
  minHeight: 0,
  overflowY: "auto",
  overflowX: "hidden",
  paddingLeft: "20px",
  paddingRight: "4px",
  ...checkoutScrollbarStyles,
}));
 
const GivePreviousChecksSectionSkeleton = () => {
  // Render 20 skeleton items to fill the scroll container
  return (
    <TaskCard
      title="Previous Checks"
      containerSx={{
        display: "flex",
        flexDirection: "column",
        flex: 1,
        minHeight: 0,
        "& > div:first-of-type": { minHeight: 54, p: "8px 20px" },
      }}
      sx={{
        p: 0,
        display: "flex",
        flexDirection: "column",
        flex: 1,
        minHeight: 0,
      }}
    >
      <TaskCardScrollContainer
        sx={{
          paddingTop: "14px",
          paddingRight: "20px",
          overflow: "hidden",
        }}
      >
        <AnimatedSkeletonsContainer spacing={0} width="100%">
          {Array.from({ length: 30 }).map((_, index) => (
            <Stack
              key={index}
              direction="row"
              justifyContent="space-between"
              alignItems="center"
              pt={index === 0 ? "0px" : "12px"}
              pb="12px"
              px="0px"
              width="100%"
            >
              {/* Date skeleton - 200px width, 20px height */}
              <Skeleton
                variant="rounded"
                width={200}
                height={20}
                sx={{ borderRadius: "12px" }}
              />
              {/* Chip skeleton - 60px width, 20px height */}
              <Skeleton
                variant="rounded"
                width={60}
                height={20}
                sx={{ borderRadius: "12px", mr: "0px" }}
              />
            </Stack>
          ))}
        </AnimatedSkeletonsContainer>
      </TaskCardScrollContainer>
    </TaskCard>
  );
};
 
export default GivePreviousChecksSectionSkeleton;