|
| 1 | +import React from "react"; |
| 2 | +import { makeStyles } from "@material-ui/core/styles"; |
| 3 | +import Table from "@material-ui/core/Table"; |
| 4 | +import TableBody from "@material-ui/core/TableBody"; |
| 5 | +import TableCell from "@material-ui/core/TableCell"; |
| 6 | +import TableContainer from "@material-ui/core/TableContainer"; |
| 7 | +import TableHead from "@material-ui/core/TableHead"; |
| 8 | +import TableRow from "@material-ui/core/TableRow"; |
| 9 | +import Paper from "@material-ui/core/Paper"; |
| 10 | + |
| 11 | +const useStyles = makeStyles({ |
| 12 | + table: { |
| 13 | + minWidth: 650, |
| 14 | + }, |
| 15 | +}); |
| 16 | + |
| 17 | +function createData(name, calories, fat, carbs, protein) { |
| 18 | + return { name, calories, fat, carbs, protein }; |
| 19 | +} |
| 20 | + |
| 21 | +// tableData = { data }; |
| 22 | +// districtLevel = { districtLevel }; |
| 23 | +// isDarkMode = { isDarkMode }; |
| 24 | + |
| 25 | +const rows = [ |
| 26 | + createData("Frozen yoghurt", 159, 6.0, 24, 4.0), |
| 27 | + createData("Ice cream sandwich", 237, 9.0, 37, 4.3), |
| 28 | + createData("Eclair", 262, 16.0, 24, 6.0), |
| 29 | + createData("Cupcake", 305, 3.7, 67, 4.3), |
| 30 | + createData("Gingerbread", 356, 16.0, 49, 3.9), |
| 31 | +]; |
| 32 | + |
| 33 | +export default function SimpleTable(props) { |
| 34 | + const classes = useStyles(); |
| 35 | + |
| 36 | + return ( |
| 37 | + <TableContainer component={Paper}> |
| 38 | + <Table className={classes.table} aria-label="simple table"> |
| 39 | + <TableHead> |
| 40 | + <TableRow> |
| 41 | + <TableCell>Name</TableCell> |
| 42 | + <TableCell align="right">Confirmed</TableCell> |
| 43 | + <TableCell align="right">Active</TableCell> |
| 44 | + <TableCell align="right">Recovered</TableCell> |
| 45 | + <TableCell align="right">Deceased</TableCell> |
| 46 | + </TableRow> |
| 47 | + </TableHead> |
| 48 | + <TableBody> |
| 49 | + {props.tableData.map((row) => ( |
| 50 | + <TableRow key={row.state}> |
| 51 | + <TableCell component="th" scope="row"> |
| 52 | + {row.state} |
| 53 | + </TableCell> |
| 54 | + <TableCell align="right">{row.confirmed}</TableCell> |
| 55 | + <TableCell align="right">{row.active}</TableCell> |
| 56 | + <TableCell align="right">{row.recovered}</TableCell> |
| 57 | + <TableCell align="right">{row.deaths}</TableCell> |
| 58 | + </TableRow> |
| 59 | + ))} |
| 60 | + </TableBody> |
| 61 | + </Table> |
| 62 | + </TableContainer> |
| 63 | + ); |
| 64 | +} |
0 commit comments