Files
Checkmate/src/Components/Charts/ChartBox/EmptyView.jsx
T

80 lines
2.3 KiB
React
Raw Normal View History

2025-02-19 22:32:09 +05:30
// Components
import { Typography, Stack } from "@mui/material";
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import IconBox from "../../IconBox";
const EmptyView = ({
icon,
header,
message = "No Data",
2025-02-25 23:10:35 +05:30
headingLevel = "h2",
2025-02-19 22:32:09 +05:30
justifyContent = "flex-start",
2025-02-25 23:10:35 +05:30
height = "100%"
2025-02-19 22:32:09 +05:30
}) => {
const theme = useTheme();
return (
<Stack
flex={1}
direction="row"
sx={{
backgroundColor: theme.palette.primary.main,
border: 1,
borderStyle: "solid",
borderColor: theme.palette.primary.lowContrast,
borderRadius: 2,
2025-02-25 23:10:35 +05:30
borderTopRightRadius: 4,
borderBottomRightRadius: 4,
2025-02-19 22:32:09 +05:30
}}
>
<Stack
flex={1}
alignItems="center"
sx={{
padding: theme.spacing(8),
justifyContent,
gap: theme.spacing(8),
height,
"& h2": {
color: theme.palette.primary.contrastTextSecondary,
fontSize: 15,
fontWeight: 500,
},
"& tspan, & text": {
fill: theme.palette.primary.contrastTextTertiary,
},
}}
>
<Stack
alignSelf="flex-start"
direction="row"
alignItems="center"
gap={theme.spacing(6)}
>
{icon && <IconBox>{icon}</IconBox>}
{header && <Typography component="h2">{header}</Typography>}
</Stack>
<Stack
flex={1}
justifyContent="center"
alignItems="center"
>
2025-02-25 23:10:35 +05:30
<Typography component={headingLevel}>
2025-02-19 22:32:09 +05:30
{message}
</Typography>
</Stack>
</Stack>
</Stack>
);
};
EmptyView.propTypes = {
message: PropTypes.string,
icon: PropTypes.node,
header: PropTypes.string,
2025-02-25 23:10:35 +05:30
headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3'])
2025-02-19 22:32:09 +05:30
};
export default EmptyView;