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

/* eslint-disable react/no-array-index-key */
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;