update skeleton component
This commit is contained in:
1 parent
fa809d7bfd
commit
b8042d6d00
1 file changed
+5
-3
@@ -1,21 +1,22 @@
|
|||||||
import { Stack, Skeleton } from "@mui/material";
|
import { Stack, Skeleton } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
const SkeletonLayout = ({ numBoxes }) => {
|
const SkeletonLayout = ({ numBoxes, flexWrap }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
|
flexWrap={flexWrap}
|
||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(4)}
|
||||||
mt={theme.spacing(4)}
|
mt={theme.spacing(4)}
|
||||||
>
|
>
|
||||||
{Array.from({ length: numBoxes }).map((_, index) => {
|
{Array.from({ length: numBoxes }).map((_, index) => {
|
||||||
const width = `${100 / numBoxes}%`;
|
const width = `${200 / numBoxes}%`;
|
||||||
return (
|
return (
|
||||||
<Skeleton
|
<Skeleton
|
||||||
variant="rounded"
|
variant="rounded"
|
||||||
width={width}
|
width={width}
|
||||||
height={50}
|
height={100}
|
||||||
key={index}
|
key={index}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -25,6 +26,7 @@ const SkeletonLayout = ({ numBoxes }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SkeletonLayout.propTypes = {
|
SkeletonLayout.propTypes = {
|
||||||
|
flexWrap: PropTypes.string,
|
||||||
numBoxes: PropTypes.number,
|
numBoxes: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user