All files / src/components/StatRow index.tsx

100% Statements 21/21
100% Branches 2/2
100% Functions 1/1
100% Lines 21/21

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  1x 1x 1x                             1x 4x 4x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 4x 4x    
import { ReactNode } from 'react';
import { formatResult } from '@/utils/statistic';
import { LegendBox } from '@/components/LegendBox';
import './style.css';
interface StatRowProps {
  items: {
    icon?: ReactNode;
    title: string;
    result: number;
    date?: string;
    line?: boolean;
    titleClassName?: string;
    resultClassName?: string;
    extraClassName?: string;
    containerClassName?: string;
  }[];
}
 
export const StatRow = ({ items }: StatRowProps) => (
  <div className="flex gap-5 overflow-x-auto whitespace-nowrap statrow-scroll">
    {items.map((item, idx) => (
      <div key={idx} className="inline-block">
        <LegendBox
          icon={item.icon}
          title={item.title}
          result={formatResult(item.result)}
          line={item.line}
          extra={item.date}
          titleClassName={item.titleClassName}
          resultClassName={item.resultClassName}
          extraClassName={item.extraClassName}
          containerClassName={item.containerClassName}
        />
      </div>
    ))}
  </div>
);