All files / organisms/BetPackerTable/mobile BetPackerSkeleton.native.tsx

14.28% Statements 1/7
0% Branches 0/13
0% Functions 0/3
16.66% Lines 1/6

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        1x                                                                                                  
import { Skeleton } from '@sb/ui/components/atoms/Skeleton';
import { Dimensions, View } from 'react-native';
import React from 'react';
 
export const BetPackerSkeleton = ({ row = 4 }: { row: number }) => {
  const WIDTH = Dimensions.get('window').width / 2.1;
  const HEIGHT = 35;
 
  const isEven = (value: number) => value % 2 === 0;
 
  return (
    <View className={'flex w-full flex-col items-center justify-evenly'}>
      {Array.from({ length: row }).map((_, rowIdx) => (
        <View
          key={rowIdx}
          className={`flex w-full flex-row items-center justify-between py-2 ${isEven(rowIdx) ? 'bg-tertiary-background' : 'bg-primary'}`}
        >
          <View className={'ml-2 flex'}>
            <Skeleton
              width={WIDTH * 0.1}
              height={HEIGHT}
              shape={'rounded'}
              className={`${isEven(rowIdx) ? 'bg-primary' : 'bg-element-nuance'}`}
            />
          </View>
          <View className={'mr-2 flex flex-1 flex-row justify-end gap-1'}>
            <Skeleton
              width={WIDTH * 0.1}
              height={HEIGHT}
              shape={'rounded'}
              className={`${isEven(rowIdx) ? 'bg-primary' : 'bg-element-nuance'}`}
            />
            <Skeleton
              width={WIDTH * 0.4}
              height={HEIGHT}
              className={`${isEven(rowIdx) ? 'bg-primary' : 'bg-element-nuance'} rounded-l-[4px]`}
            />
            <Skeleton
              width={WIDTH * 0.4}
              height={HEIGHT}
              className={`${isEven(rowIdx) ? 'bg-primary' : 'bg-element-nuance'}`}
            />
            <Skeleton
              width={WIDTH * 0.4}
              height={HEIGHT}
              className={`${isEven(rowIdx) ? 'bg-primary' : 'bg-element-nuance'} rounded-r-[4px]`}
            />
          </View>
        </View>
      ))}
    </View>
  );
};