Skip to content

Commit d562261

Browse files
committed
Improve padding and table borders
1 parent f389778 commit d562261

1 file changed

Lines changed: 27 additions & 41 deletions

File tree

src/components/MockApp/MockApp.tsx

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
Paper,
2020
Select,
2121
Stack,
22+
styled,
2223
Table,
2324
TableBody,
2425
TableCell,
@@ -34,6 +35,19 @@ import {
3435
import { useState } from "react";
3536
import { FAKE_DATA_1, FAKE_DATA_2, FAKE_DATA_3, Sparkline } from "../Sparkline/Sparkline";
3637

38+
// Remove these styled components when MUI fixes table border colors
39+
// https://github.com/mui/material-ui/issues/47749
40+
41+
const StyledTableHeaderCell = styled(TableCell)(({ theme }) => ({
42+
backgroundColor: theme.palette.background.paper,
43+
backgroundImage: "var(--Paper-overlay)",
44+
borderColor: theme.palette.divider,
45+
}));
46+
47+
const StyledTableBodyCell = styled(TableCell)(({ theme }) => ({
48+
borderColor: theme.palette.divider,
49+
}));
50+
3751
interface Order {
3852
id: string;
3953
driverName: string;
@@ -149,7 +163,7 @@ export const MockApp = () => {
149163
</Tooltip>
150164
</Toolbar>
151165
</AppBar>
152-
<Box sx={{ p: 2 }}>
166+
<Box sx={{ p: 3, pt: 2 }}>
153167
<Alert severity="warning" sx={{ mb: 2 }} onClose={() => {}}>
154168
System will be going offline at 8pm EST for maintenance
155169
</Alert>
@@ -196,49 +210,21 @@ export const MockApp = () => {
196210
<Table size="small" stickyHeader>
197211
<TableHead>
198212
<TableRow>
199-
<TableCell
200-
sx={{
201-
bgcolor: "background.paper",
202-
backgroundImage: "var(--Paper-overlay)",
203-
}}
204-
>
205-
Order ID
206-
</TableCell>
207-
<TableCell
208-
sx={{
209-
bgcolor: "background.paper",
210-
backgroundImage: "var(--Paper-overlay)",
211-
}}
212-
>
213-
Driver
214-
</TableCell>
215-
<TableCell
216-
sx={{
217-
bgcolor: "background.paper",
218-
backgroundImage: "var(--Paper-overlay)",
219-
}}
220-
>
221-
Customer
222-
</TableCell>
223-
<TableCell
224-
sx={{
225-
bgcolor: "background.paper",
226-
backgroundImage: "var(--Paper-overlay)",
227-
}}
228-
>
229-
Status
230-
</TableCell>
213+
<StyledTableHeaderCell>Order ID</StyledTableHeaderCell>
214+
<StyledTableHeaderCell>Driver</StyledTableHeaderCell>
215+
<StyledTableHeaderCell>Customer</StyledTableHeaderCell>
216+
<StyledTableHeaderCell>Status</StyledTableHeaderCell>
231217
</TableRow>
232218
</TableHead>
233219
<TableBody>
234220
{MOCK_DATA.map((data, index) => (
235221
<TableRow key={data.id}>
236-
<TableCell>
222+
<StyledTableBodyCell>
237223
<Link href="#">
238224
<b>{data.id}</b>
239225
</Link>
240-
</TableCell>
241-
<TableCell>
226+
</StyledTableBodyCell>
227+
<StyledTableBodyCell>
242228
<Stack direction="row" gap={1} alignItems="center">
243229
<Avatar
244230
sx={{
@@ -251,18 +237,18 @@ export const MockApp = () => {
251237
/>
252238
<Typography sx={{ lineHeight: 1 }}>{data.driverName}</Typography>
253239
</Stack>
254-
</TableCell>
255-
<TableCell>
240+
</StyledTableBodyCell>
241+
<StyledTableBodyCell>
256242
<Box>
257243
<Typography>{data.customer}</Typography>
258244
<Typography variant="subtitle2" color="textSecondary">
259245
{data.orderer}
260246
</Typography>
261247
</Box>
262-
</TableCell>
263-
<TableCell>
248+
</StyledTableBodyCell>
249+
<StyledTableBodyCell>
264250
<Chip color={STATUS_TO_COLOR_MAP[data.status]} label={data.status} />
265-
</TableCell>
251+
</StyledTableBodyCell>
266252
</TableRow>
267253
))}
268254
</TableBody>

0 commit comments

Comments
 (0)