All files / apps/host/src/components/InfoGrid index.tsx

100% Statements 6/6
100% Branches 2/2
100% Functions 3/3
100% Lines 6/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                  4x 3x     5x 1x     2x               4x          
import { View } from 'react-native';
 
import { InfoItem } from './InfoItem';
import { InfoData } from './types';
 
interface InfoProps {
  data: (InfoData[] | InfoData)[];
}
 
export const InfoGrid = ({ data }: InfoProps) => {
  return (
    <View className="flex-col gap-4">
      {data.map((item, index) => {
        if (Array.isArray(item)) {
          return (
            <View key={index} className="flex-row justify-between">
              {(item as InfoData[]).map(i => (
                <View key={i.title} className="w-[48%]">
                  <InfoItem {...i} />
                </View>
              ))}
            </View>
          );
        }
 
        return <InfoItem key={index} {...(item as InfoData)} />;
      })}
    </View>
  );
};