aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/components/TableShimmer.js
blob: e7d12f953313f73a3e60430ddebe898c2a5650c5 (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(() => (
  <TableRow>
    {[...Array(columns)].map((_, i) => {
      const action = (startAction && i === 0) || (endAction && i === columns - 1);
      return (
        <TableCell padding={action ? 'none' : 'normal'}>
          {!action && <Skeleton />}
        </TableCell>
      );
    })}
  </TableRow>
));

export default TableShimmer;