Feat: Empty View Component for Chart Boxes

This commit is contained in:
Aryaman Kumar Sharma committed 2025-02-25 23:10:35 +05:30
1 parent 2879126565
commit f4021e8cd5
2 files changed
+7 -9

No files matched your search

+6 -8
View File
@@ -8,10 +8,9 @@ const EmptyView = ({
icon, icon,
header, header,
message = "No Data", message = "No Data",
size = "h2", headingLevel = "h2",
borderRadiusRight = 4,
justifyContent = "flex-start", justifyContent = "flex-start",
height = "300px" height = "100%"
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -25,8 +24,8 @@ const EmptyView = ({
borderStyle: "solid", borderStyle: "solid",
borderColor: theme.palette.primary.lowContrast, borderColor: theme.palette.primary.lowContrast,
borderRadius: 2, borderRadius: 2,
borderTopRightRadius: borderRadiusRight, borderTopRightRadius: 4,
borderBottomRightRadius: borderRadiusRight, borderBottomRightRadius: 4,
}} }}
> >
<Stack <Stack
@@ -37,7 +36,6 @@ const EmptyView = ({
justifyContent, justifyContent,
gap: theme.spacing(8), gap: theme.spacing(8),
height, height,
minWidth: 250,
"& h2": { "& h2": {
color: theme.palette.primary.contrastTextSecondary, color: theme.palette.primary.contrastTextSecondary,
fontSize: 15, fontSize: 15,
@@ -63,7 +61,7 @@ const EmptyView = ({
justifyContent="center" justifyContent="center"
alignItems="center" alignItems="center"
> >
<Typography component={size}> <Typography component={headingLevel}>
{message} {message}
</Typography> </Typography>
</Stack> </Stack>
@@ -76,7 +74,7 @@ EmptyView.propTypes = {
message: PropTypes.string, message: PropTypes.string,
icon: PropTypes.node, icon: PropTypes.node,
header: PropTypes.string, header: PropTypes.string,
size: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'body1', 'body2']) headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3'])
}; };
export default EmptyView; export default EmptyView;
@@ -97,7 +97,7 @@ const ChartBoxes = ({
icon={<IncidentsIcon />} icon={<IncidentsIcon />}
header="Incidents" header="Incidents"
noDataMessage="Great. No Incidents, yet!" noDataMessage="Great. No Incidents, yet!"
isEmpty={!monitor?.groupedDownChecks?.length} isEmpty={monitor?.groupedDownChecks?.length === 0}
> >
<Stack width={"100%"}> <Stack width={"100%"}>
<Box position="relative"> <Box position="relative">