|
| 1 | +import { useEffect, useState } from "react"; |
| 2 | + |
| 3 | +import { MatchDetailsData } from "../Common/types"; |
| 4 | + |
| 5 | +export type MatchDetailsProps = { |
| 6 | + matchData: MatchDetailsData[]; |
| 7 | + header: string[]; |
| 8 | +}; |
| 9 | + |
| 10 | +export default function List({ matchData, header }: MatchDetailsProps) { |
| 11 | + return ( |
| 12 | + <div className="w-full overflow-hidden rounded-lg shadow-lg"> |
| 13 | + <div className="overflow-x-auto"> |
| 14 | + <table className="min-w-full bg-white"> |
| 15 | + <thead> |
| 16 | + <tr className="title bg-primary text-center font-bold text-white"> |
| 17 | + {header.map((row, index) => ( |
| 18 | + <th key={index} className="px-6 py-4 md:text-lg"> |
| 19 | + {row} |
| 20 | + </th> |
| 21 | + ))} |
| 22 | + </tr> |
| 23 | + </thead> |
| 24 | + <tbody className="body-sm"> |
| 25 | + {matchData.map((row, index) => ( |
| 26 | + <tr |
| 27 | + key={index} |
| 28 | + className={`border-b border-gray-200 bg-green-50 text-center hover:bg-gray-100`} |
| 29 | + > |
| 30 | + <td className="px-6 py-4">{row.teamName}</td> |
| 31 | + <td className="px-6 py-4">{row.opponent}</td> |
| 32 | + <td className="px-6 py-4">{row.whitePins}</td> |
| 33 | + <td className="px-6 py-4">{row.penaltyPins}</td> |
| 34 | + <td className="px-6 py-4">{row.yellowCard}</td> |
| 35 | + <td className="px-6 py-4">{row.redCard}</td> |
| 36 | + <td className="px-6 py-4">{row.p1_postion}</td> |
| 37 | + <td className="px-6 py-4">{row.p2_postion}</td> |
| 38 | + <td className="px-6 py-4">{row.honorPoint}</td> |
| 39 | + <td className="px-6 py-4">{row.regularPoint}</td> |
| 40 | + <td className="px-6 py-4">{row.completedTime}</td> |
| 41 | + </tr> |
| 42 | + ))} |
| 43 | + </tbody> |
| 44 | + </table> |
| 45 | + </div> |
| 46 | + </div> |
| 47 | + ); |
| 48 | +} |
0 commit comments