Placed the TableContainer in a box to better match figma design.

This commit is contained in:
M M committed 2024-07-02 20:24:51 -07:00
1 parent 75d16b749d
commit c2b47e5cc4
1 file changed
+20 -7
+20 -7
View File
@@ -1,4 +1,4 @@
import { styled } from '@mui/material/styles'; import { styled, useTheme } from '@mui/material/styles';
import Table from '@mui/material/Table'; import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody'; import TableBody from '@mui/material/TableBody';
import TableCell, { tableCellClasses } from '@mui/material/TableCell'; import TableCell, { tableCellClasses } from '@mui/material/TableCell';
@@ -6,9 +6,9 @@ import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead'; import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow'; import TableRow from '@mui/material/TableRow';
import Paper from '@mui/material/Paper'; import Paper from '@mui/material/Paper';
import Box from '@mui/material/Box';
import { StatusLabel } from "../../Components/Label/"; import { StatusLabel } from "../../Components/Label/";
const StyledTableCell = styled(TableCell)(({ theme }) => ({ const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: { [`&.${tableCellClasses.head}`]: {
backgroundColor: theme.palette.action.hover, backgroundColor: theme.palette.action.hover,
@@ -31,8 +31,8 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({
}, },
})); }));
function createData(name, calories, fat, carbs, protein) { function createData(name, date, message) {
return { name, calories, fat, carbs, protein }; return { name, date, message };
} }
const rows = [ const rows = [
@@ -43,9 +43,21 @@ const rows = [
createData(<StatusLabel status="Down" customStyles={{ backgroundColor: '#fff9f9', borderColor: '#ffcac6', color: '#344054' }} />, '2024-03-14 21:41:09', 'HTTP 350 - NOK'), createData(<StatusLabel status="Down" customStyles={{ backgroundColor: '#fff9f9', borderColor: '#ffcac6', color: '#344054' }} />, '2024-03-14 21:41:09', 'HTTP 350 - NOK'),
]; ];
export default function CustomizedTables() { export default function CustomizedTables() {
const theme = useTheme();
return ( return (
<Box
sx={{
marginTop: theme.spacing(4),
marginX: 'auto',
width: '80%',
paddingX: theme.spacing(6),
[theme.breakpoints.down('md')]: {
width: '100%',
},
}}
>
<TableContainer component={Paper}> <TableContainer component={Paper}>
<Table sx={{ minWidth: 700 }} aria-label="customized table"> <Table sx={{ minWidth: 700 }} aria-label="customized table">
<TableHead> <TableHead>
@@ -61,12 +73,13 @@ export default function CustomizedTables() {
<StyledTableCell component="th" scope="row"> <StyledTableCell component="th" scope="row">
{row.name} {row.name}
</StyledTableCell> </StyledTableCell>
<StyledTableCell align="right">{row.calories}</StyledTableCell> <StyledTableCell align="right">{row.date}</StyledTableCell>
<StyledTableCell align="right">{row.fat}</StyledTableCell> <StyledTableCell align="right">{row.message}</StyledTableCell>
</StyledTableRow> </StyledTableRow>
))} ))}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>
</Box>
); );
} }