2021-03-16 10:42:12 +01:00
|
|
|
import * as React from "react";
|
|
|
|
|
2021-06-18 22:22:12 +02:00
|
|
|
export function StatsTable(rows: any[][], title?: string): React.ReactElement {
|
2021-09-05 01:09:30 +02:00
|
|
|
let titleElem = <></>;
|
|
|
|
if (title) {
|
|
|
|
titleElem = (
|
|
|
|
<>
|
|
|
|
<h2>
|
|
|
|
<u>{title}</u>
|
|
|
|
</h2>
|
|
|
|
<br />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{titleElem}
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
{rows.map((row: any[]) => {
|
|
|
|
return (
|
|
|
|
<tr key={row[0]}>
|
|
|
|
{row.map((elem: any, i: number) => {
|
|
|
|
let style = {};
|
2021-09-09 05:47:34 +02:00
|
|
|
if (i !== 0) style = { textAlign: "right", paddingLeft: ".25em" };
|
2021-09-05 01:09:30 +02:00
|
|
|
return (
|
|
|
|
<td key={i} style={style}>
|
|
|
|
{elem}
|
|
|
|
</td>
|
|
|
|
);
|
2021-03-16 10:42:12 +01:00
|
|
|
})}
|
2021-09-05 01:09:30 +02:00
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|