synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
48 lines (47 loc) • 1.03 kB
JavaScript
import { jsx as r } from "react/jsx-runtime";
import { useState as f, useEffect as u, Fragment as h } from "react";
import d from "@mui/material/Skeleton";
import { times as c } from "lodash-es";
import { Box as g } from "@mui/material";
function x(t, e) {
return Math.floor(Math.random() * (e - t) + t);
}
function M(t) {
const {
numRows: e = 5,
numCols: o = 2,
rowHeight: n,
fullWidthCells: s = !1,
...l
} = t, [i, a] = f([]);
return u(() => {
const m = [];
c(e * o, (p) => {
m.push(
/* @__PURE__ */ r(h, { children: /* @__PURE__ */ r(
d,
{
height: n,
width: s ? "100%" : `${x(35, 75)}%`
}
) }, p)
);
}), a(m);
}, [e, o, n, s]), /* @__PURE__ */ r(
g,
{
...l,
sx: {
display: "grid",
gridTemplateColumns: "auto ".repeat(o),
gap: "8px",
...l.sx
},
children: i
}
);
}
export {
M as SkeletonTable
};
//# sourceMappingURL=SkeletonTable.js.map