Advertisement
haroldjcastillo

mt

Jun 24th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. /* Table icons */
  3. import TableCell from "@material-ui/core/TableCell";
  4. import TableRow from "@material-ui/core/TableRow";
  5. import TableHead from "@material-ui/core/TableHead";
  6. import Table from "@material-ui/core/Table";
  7. import Paper from "@material-ui/core/Paper";
  8. import TableBody from "@material-ui/core/TableBody";
  9. import styles from "./styles";
  10. import {withStyles} from "@material-ui/styles";
  11. import PropTypes from 'prop-types';
  12.  
  13. let id = 0;
  14.  
  15. function createData(name, calories, fat, carbs, protein) {
  16.   id += 1;
  17.   return {id, name, calories, fat, carbs, protein};
  18. }
  19.  
  20. const rows = [
  21.   createData("Frozen yoghurt", 159, 6.0, 24, 4.0),
  22.   createData("Ice cream sandwich", 237, 9.0, 37, 4.3),
  23.   createData("Eclair", 262, 16.0, 24, 6.0),
  24.   createData("Cupcake", 305, 3.7, 67, 4.3),
  25.   createData("Gingerbread", 356, 16.0, 49, 3.9)
  26. ];
  27.  
  28. function OrderTable({orders, handleRow, selectedRow, classes}) {
  29.   return (
  30.     <Paper className={classes.root}>
  31.       <Table className={classes.table}>
  32.         <TableHead>
  33.           <TableRow>
  34.             <TableCell>Dessert (100g serving)</TableCell>
  35.             <TableCell align="right">Calories</TableCell>
  36.             <TableCell align="right">Calories</TableCell>
  37.             <TableCell align="right">Calories</TableCell>
  38.             <TableCell align="right">Calories</TableCell>
  39.             <TableCell align="right">Calories</TableCell>
  40.             <TableCell align="right">Fat (g)</TableCell>
  41.             <TableCell align="right">Carbs (g)</TableCell>
  42.             <TableCell align="right">Protein (g)</TableCell>
  43.           </TableRow>
  44.         </TableHead>
  45.         <TableBody>
  46.           {rows.map(row => {
  47.             return (
  48.               <TableRow key={row.id}>
  49.                 <TableCell component="th" scope="row">
  50.                   {row.name}
  51.                 </TableCell>
  52.                 <TableCell align="right">{row.calories}</TableCell>
  53.                 <TableCell align="right">{row.fat}</TableCell>
  54.                 <TableCell align="right">{row.carbs}</TableCell>
  55.                 <TableCell align="right">{row.protein}</TableCell>
  56.               </TableRow>
  57.             );
  58.           })}
  59.         </TableBody>
  60.       </Table>
  61.     </Paper>
  62.   );
  63. }
  64.  
  65. OrderTable.propTypes = {
  66.   classes: PropTypes.object.isRequired
  67. };
  68.  
  69. export default withStyles(styles)(OrderTable);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement