diff --git a/phone/src/apps/bank/components/transactions/TransactionList.tsx b/phone/src/apps/bank/components/transactions/TransactionList.tsx index 233af19..09b68a0 100644 --- a/phone/src/apps/bank/components/transactions/TransactionList.tsx +++ b/phone/src/apps/bank/components/transactions/TransactionList.tsx @@ -1,19 +1,116 @@ -import React from "react"; +import React, { useState } from "react"; import { List } from "../../../../ui/components/List"; import { ListItem } from "../../../../ui/components/ListItem"; import ListItemText from "@material-ui/core/ListItemText"; +import { Typography, makeStyles } from "@material-ui/core"; + +import Table from '@material-ui/core/Table'; +import TableBody from '@material-ui/core/TableBody'; +import TableCell from '@material-ui/core/TableCell'; +import TableContainer from '@material-ui/core/TableContainer'; +import TableHead from '@material-ui/core/TableHead'; +import TableRow from '@material-ui/core/TableRow'; +import TablePagination from '@material-ui/core/TablePagination'; +import Paper from '@material-ui/core/Paper'; +import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; + +const useStyles = makeStyles((theme) => ({ + paper: { + padding: theme.spacing(1), + textAlign: 'center', + width: "50%", + backgroundColor: "#2d3436", + margin: 20, + color: "#fff", + }, + table: { + width: "100%", + color: "#fff" + }, + cell: { + color: "#fff", + }, + container: { + maxHeight: 350, + }, + list: { + marginTop: "13em" + } +})) + +const columns = [ + { id: 'type', label: 'Type', minWidth: 100 }, + { id: 'amount', label: 'Amount', minWidth: 100 }, + { + id: 'message', + label: 'Message', + minWidth: 170, + align: 'left', + format: (value: number) => value.toLocaleString('en-US') + }, +]; + export const TransactionList = ({ transactions }) => { + + const classes = useStyles(); + const [page, setPage] = useState(0); + const [rowsPerPage, setRowsPerPage] = useState(4); + + const handleChangePage = (event, newPage) => { + setPage(newPage); + }; + + const handleChangeRowsPerPage = (event) => { + setRowsPerPage(+event.target.value); + setPage(0); + }; + return ( - - {transactions.map((transaction) => ( - - - - ))} - + <> + + + + + + {columns.map((column) => ( + + {column.label} + + ))} + + + + {transactions.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((row) => { + return ( + + {columns.map((column) => { + const value = row[column.id]; + return ( + + {column.format && typeof value === 'number' ? column.format(value) : value} + + ); + })} + + ); + })} + +
+
+ +
+ ); };