mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-24 02:33:16 +02:00
24 lines
772 B
TypeScript
24 lines
772 B
TypeScript
import * as React from "react";
|
|
|
|
export function StatsTable(rows: any[][], title?: string): React.ReactElement {
|
|
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 = {};
|
|
if (i !== 0) style = {textAlign: 'right', paddingLeft: '.25em'};
|
|
return <td key={i} style={style}>{elem}</td>
|
|
})}
|
|
</tr>
|
|
})}
|
|
</tbody>
|
|
</table>
|
|
</>);
|
|
} |