diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-20 08:52:38 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-20 08:52:38 -0700 |
commit | b84fa9a5ee0d68dd922b2fb13a62e9b453397da0 (patch) | |
tree | f8d98846b18ebe8b7af916147964551cebab6208 /modern/src/common/components/TableShimmer.js | |
parent | d2de65460577a46dfa20f8df6870b10fa9c7d49e (diff) | |
download | trackermap-web-b84fa9a5ee0d68dd922b2fb13a62e9b453397da0.tar.gz trackermap-web-b84fa9a5ee0d68dd922b2fb13a62e9b453397da0.tar.bz2 trackermap-web-b84fa9a5ee0d68dd922b2fb13a62e9b453397da0.zip |
Add shimmer to reports
Diffstat (limited to 'modern/src/common/components/TableShimmer.js')
-rw-r--r-- | modern/src/common/components/TableShimmer.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/modern/src/common/components/TableShimmer.js b/modern/src/common/components/TableShimmer.js index 3208551f..e7d12f95 100644 --- a/modern/src/common/components/TableShimmer.js +++ b/modern/src/common/components/TableShimmer.js @@ -1,13 +1,16 @@ import React from 'react'; import { Skeleton, TableCell, TableRow } from '@mui/material'; -const TableShimmer = ({ columns }) => [...Array(3)].map(() => ( +const TableShimmer = ({ columns, startAction, endAction }) => [...Array(3)].map(() => ( <TableRow> - {[...Array(columns)].map(() => ( - <TableCell> - <Skeleton /> - </TableCell> - ))} + {[...Array(columns)].map((_, i) => { + const action = (startAction && i === 0) || (endAction && i === columns - 1); + return ( + <TableCell padding={action ? 'none' : 'normal'}> + {!action && <Skeleton />} + </TableCell> + ); + })} </TableRow> )); |