Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/web/ui/src/features/component/Table.tsx
5304 views
1
import React from 'react';
2
3
import styles from './Table.module.css';
4
5
interface Props {
6
tableHeaders: string[];
7
style?: React.CSSProperties;
8
renderTableData: () => JSX.Element[];
9
}
10
11
/**
12
* Simple table component that accept a custom header, and custom render
13
* function for the table data
14
*/
15
const Table = ({ tableHeaders, style = {}, renderTableData }: Props) => {
16
return (
17
<table className={styles.table}>
18
<colgroup span={1} style={style} />
19
<tbody>
20
<tr>
21
{tableHeaders.map((header) => (
22
<th key={header}>{header}</th>
23
))}
24
</tr>
25
{renderTableData()}
26
</tbody>
27
</table>
28
);
29
};
30
31
export default Table;
32
33