aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/components/TableShimmer.jsx
blob: 08a984a42289e185bfe5c3f6188c095a7b61cf8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import React from 'react';
import { Skeleton, TableCell, TableRow } from '@mui/material';

const TableShimmer = ({ columns, startAction, endAction }) => [...Array(3)].map((_, i) => (
  <TableRow key={-i}>
    {[...Array(columns)].map((_, j) => {
      const action = (startAction && j === 0) || (endAction && j === columns - 1);
      return (
        <TableCell key={-j} padding={action ? 'none' : 'normal'}>
          {!action && <Skeleton />}
        </TableCell>
      );
    })}
  </TableRow>
));

export default TableShimmer;