All files / src/features/Minibuilders/Conversations/Chat ThreadSkeleton.tsx

100% Statements 6/6
0% Branches 0/1
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        21x 30x     10x     90x       30x                                                              
import UnfoldListItems from "@components/animation/UnfoldListItems";
import CommentLayout from "./CommentLayout";
import { Skeleton } from "@mui/material";
 
const ThreadSkeleton = ({length = 3}: {length?: number}) => {
  const skeletonItems = Array.from({ length }, (_, i) => ({
    id: `skeleton-${i}`,
  }));
  return (
    <UnfoldListItems
      items={skeletonItems}
      renderKey={(row, idx) => row.id}
      height={60}
      animationName="waterfall"
      ItemComponent={(row, idx, height) => (
          <CommentLayout
            sx={{
              width: "100%",
            }}
            action={
              <Skeleton
                variant="rectangular"
                width={200}
                height={32}
                sx={{ fontSize: "14px", borderRadius: "8px" }}
              />
            }
            message={
              <Skeleton variant="rectangular" width={260} height={21} sx={{borderRadius: "8px"}} />
            }
            name={
              <Skeleton
                variant="rectangular"
                width={200}
                height={21}
                sx={{ fontSize: "14px", borderRadius: "8px" }}
              />
            }
            image={<Skeleton variant="circular" width={24} height={24} />}
          />
      )}
    />
  );
};
 
export default ThreadSkeleton;