Files
Checkmate/client/src/Components/MonitorCountHeader/index.jsx
T

52 lines
1.1 KiB
React
Raw Normal View History

2025-04-09 22:34:59 +05:30
import { Stack, Typography } from "@mui/material";
2025-01-28 11:04:11 -08:00
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import SkeletonLayout from "./skeleton";
const MonitorCountHeader = ({
2025-06-16 11:34:41 +08:00
isLoading = false,
2025-01-28 11:04:11 -08:00
monitorCount,
2025-04-09 22:34:59 +05:30
heading = "monitors",
2025-01-28 11:04:11 -08:00
sx,
children,
}) => {
const theme = useTheme();
2025-06-16 11:34:41 +08:00
if (isLoading) return <SkeletonLayout />;
2025-01-28 11:04:11 -08:00
2025-04-09 22:34:59 +05:30
if (monitorCount === 1) {
heading = "monitor";
}
2025-01-28 11:04:11 -08:00
return (
<Stack
direction="row"
alignItems="center"
2025-04-09 22:34:59 +05:30
display="flex"
width="fit-content"
height={theme.spacing(18)}
2025-01-28 11:04:11 -08:00
gap={theme.spacing(2)}
2025-04-09 22:34:59 +05:30
mt={theme.spacing(2)}
px={theme.spacing(4)}
pt={theme.spacing(2)}
pb={theme.spacing(3)}
borderRadius={theme.spacing(1)}
sx={{
...sx,
backgroundColor: theme.palette.secondary.main,
}}
2025-01-28 11:04:11 -08:00
>
2025-04-09 22:34:59 +05:30
{monitorCount} <Typography component="h2">{heading}</Typography>
2025-01-28 11:04:11 -08:00
{children}
</Stack>
);
};
MonitorCountHeader.propTypes = {
2025-06-16 11:34:41 +08:00
isLoading: PropTypes.bool,
2025-01-28 11:04:11 -08:00
monitorCount: PropTypes.number,
heading: PropTypes.string,
children: PropTypes.node,
sx: PropTypes.object,
};
export default MonitorCountHeader;