All files / src/components/common/Skeleton atoms.tsx

73.33% Statements 33/45
33.33% Branches 3/9
50% Functions 11/22
73.33% Lines 33/45

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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307      264x               39770x                   264x 5540x                 264x 1400x               264x                           264x 950x               264x 1625x             264x                                       264x                                 264x                               264x 800x                             264x                 264x       264x 7180x                         264x                                                   264x                 264x 1280x                   264x 180x                                           264x                 264x                                                           264x 120x             264x                 264x         120x                  
import { Skeleton, SkeletonProps, Stack } from "@mui/material";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
 
export const TextSkeleton = ({
  height = 18,
  width,
  ...rest
}: {
  height?: number | string;
  width?: number | string;
} & SkeletonProps) => {
  return (
    <Skeleton
      variant="text"
      height={height}
      width={width}
      sx={{ flexGrow: 1, ...(rest?.sx && rest?.sx) }}
    />
  );
};
 
export const MerchantFirstCell = () => {
  return (
    <>
      <Skeleton variant="circular" width={20} height={20} />
      <Skeleton variant="rounded" width={40} height={40} />
      <TextSkeleton />
    </>
  );
};
 
export const AvatarWithName = () => {
  return (
    <>
      <Skeleton variant="rounded" width={40} height={40} />
      <TextSkeleton />
    </>
  );
};
 
export const ProductTitleCell = () => {
  const { isDesktopView } = useCustomThemeV2();
 
  return (
    <>
      <Skeleton variant="rounded" width={40} height={40} />
      <Stack width="100%">
        <TextSkeleton width={isDesktopView ? "70%" : "50%"} />
        {!isDesktopView && <TextSkeleton width="30%" />}
      </Stack>
    </>
  );
};
 
export const AssigneeSkeleton = () => {
  return (
    <>
      <Skeleton variant="circular" width={24} height={24} />
      <TextSkeleton />
    </>
  );
};
 
export const HalfTextSkeleton = () => {
  return (
    <Stack width="100%">
      <TextSkeleton width="50%" />
    </Stack>
  );
};
 
export const PhaseSkeleton = () => {
  return (
    <>
      <Skeleton
        variant="rounded"
        width={61}
        height={22}
        sx={{ borderRadius: "47px" }}
      />
      <Skeleton
        variant="rounded"
        width={30}
        height={10}
        sx={{ borderRadius: "15px" }}
      />
      <TextSkeleton height={6} />
    </>
  );
};
 
export const ListItemTitle = () => {
  return (
    <>
      <Skeleton variant="rounded" width={64} height={64} />
      <Stack
        direction="column"
        gap="6px"
        alignItems="flex-start"
        flexGrow={1}
        justifyContent="center"
      >
        <TextSkeleton width="90%" />
        <TextSkeleton width="90%" />
      </Stack>
    </>
  );
};
export const InOutSkeleton = () => {
  return (
    <Stack
      direction="column"
      gap="4px"
      width="67px"
      flexGrow={1}
      alignItems="flex-end"
      justifyContent="center"
    >
      <TextSkeleton width={67} />
      <TextSkeleton width={50} height={16} />
    </Stack>
  );
};
 
export const DoubleRowText = () => {
  return (
    <Stack
      direction="column"
      gap="4px"
      width="67px"
      flexGrow={1}
      alignItems="flex-start"
      justifyContent="center"
    >
      <TextSkeleton width="90%" />
      <TextSkeleton width="70%" height={16} />
    </Stack>
  );
};
 
export const ProcessingMerchantSkeleton = () => {
  return (
    <Stack direction="column" gap="4px" flexGrow={1} justifyContent="center">
      <TextSkeleton width="90%" />
      <TextSkeleton />
    </Stack>
  );
};
 
export const TagSkeleton = () => {
  return <Skeleton variant="rectangular" height={22} width="100%" />;
};
 
export const TagSkeletonRound = () => {
  return (
    <Skeleton
      variant="rectangular"
      height={26}
      width="100%"
      sx={{
        maxWidth: "120px",
        borderRadius: "100px",
      }}
    />
  );
};
 
export const TransactionFirst = () => {
  return (
    <Stack
      direction="column"
      gap="4px"
      justifyContent="center"
      flexGrow={1}
      width="20vw"
    >
      <TextSkeleton height={22} width="90%" sx={{ borderRadius: "20px" }} />
      <Skeleton
        variant="rounded"
        height={11}
        width="50%"
        sx={{ flexGrow: 1, borderRadius: "20px" }}
      />
      <Skeleton
        variant="rounded"
        height={11}
        width="40%"
        sx={{ flexGrow: 1, borderRadius: "20px" }}
      />
    </Stack>
  );
};
 
export const MemberSkeleton = () => {
  return (
    <>
      <Skeleton variant="circular" width={32} height={32} />
      <ProcessingMerchantSkeleton />
    </>
  );
};
 
export const ActionsSkeleton = () => {
  return (
    <Skeleton
      variant="rectangular"
      width={32}
      height={24}
      sx={{ borderRadius: "4px" }}
    />
  );
};
 
export const RiskLevelCell = () => {
  return (
    <>
      <Skeleton
        variant="circular"
        width={16}
        height={16}
        sx={{
          flexShrink: 0,
        }}
      />
      <Skeleton
        variant="rectangular"
        height={26}
        width="100%"
        sx={{
          borderRadius: "20px",
        }}
      />
    </>
  );
};
 
export const CustomerProfileSkeleton = () => {
  return (
    <Stack width="100%" gap="8px">
      <RoundedSkeleton width="50%" height={8} />
      <RoundedSkeleton variant="rectangular" />
    </Stack>
  );
};
 
export const ApiKeyMobileSkeleton = () => {
  return (
    <Stack
      width="100%"
      gap="8px"
      sx={{
        paddingTop: "12px",
        paddingBottom: "12px",
      }}
    >
      <Stack direction="row" justifyContent="space-between" alignItems="center">
        <RoundedSkeleton width="96px" />
        <Skeleton
          variant="circular"
          width="24px"
          height="24px"
          sx={{
            flexShrink: 0,
          }}
        />
      </Stack>
      <RoundedSkeleton width="178px" />
      <RoundedSkeleton
        variant="rectangular"
        sx={{ marginTop: "10px", marginBottom: "10px" }}
      />
    </Stack>
  );
};
 
export const AmountSkeleton = () => {
  return (
    <Stack alignItems="flex-end" width="100%" gap="8px">
      <RoundedSkeleton width="40%" />
    </Stack>
  );
};
 
export const CustomerActionsSkeleton = () => {
  return (
    <Stack direction="row" justifyContent="flex-end" width="100%" gap="8px">
      <RoundedSkeleton width="12px" />
      <RoundedSkeleton width="12px" />
    </Stack>
  );
};
 
export const RoundedSkeleton = ({
  height = 12,
  width = "100%",
  ...rest
}: SkeletonProps) => {
  return (
    <Skeleton
      variant="rectangular"
      width={width}
      sx={{ borderRadius: "6px", ...rest?.sx }}
      height={height}
    />
  );
};