Added placeholder checks
This commit is contained in:
1 parent
8d75c52a72
commit
931d15c451
1 file changed
+28
-2
@@ -6,6 +6,16 @@ import "./index.css";
|
||||
const BarChart = ({ checks = [] }) => {
|
||||
const theme = useTheme();
|
||||
|
||||
// set responseTime to average if there's only one check
|
||||
if (checks.length === 1) {
|
||||
checks[0] = { ...checks[0], responseTime: 50 };
|
||||
}
|
||||
|
||||
if (checks.length !== 25) {
|
||||
const placeholders = Array(25 - checks.length).fill("placeholder");
|
||||
checks = [...checks, ...placeholders];
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack
|
||||
direction="row"
|
||||
@@ -18,7 +28,19 @@ const BarChart = ({ checks = [] }) => {
|
||||
cursor: "default",
|
||||
}}
|
||||
>
|
||||
{checks.map((check) => (
|
||||
{checks.map((check, index) =>
|
||||
check === "placeholder" ? (
|
||||
<Box
|
||||
key={`${check}-${index}`}
|
||||
position="relative"
|
||||
width="9px"
|
||||
height="100%"
|
||||
backgroundColor={theme.palette.otherColors.fillGray}
|
||||
sx={{
|
||||
borderRadius: "3px",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Tooltip
|
||||
title={
|
||||
<>
|
||||
@@ -83,6 +105,9 @@ const BarChart = ({ checks = [] }) => {
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "3px",
|
||||
"&:hover > .MuiBox-root": {
|
||||
filter: "brightness(0.8)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
@@ -101,7 +126,8 @@ const BarChart = ({ checks = [] }) => {
|
||||
/>
|
||||
</Box>
|
||||
</Tooltip>
|
||||
))}
|
||||
)
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user