Files
Checkmate/client/src/Pages/Infrastructure/Details/Components/GaugeBoxes/Gauge.jsx
T

88 lines
2.0 KiB
React
Raw Normal View History

2025-01-31 13:43:57 -08:00
// Components
import CustomGauge from "../../../../../Components/Charts/CustomGauge";
import BaseContainer from "../BaseContainer";
import { Stack, Typography, Box } from "@mui/material";
// Utils
import { useTheme } from "@emotion/react";
import PropTypes from "prop-types";
const Gauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo }) => {
const theme = useTheme();
2025-03-04 00:58:59 +05:30
const valueStyle = {
2025-03-04 01:03:00 +05:30
borderRadius: theme.spacing(2),
2025-03-01 10:21:39 +05:30
backgroundColor: theme.palette.tertiary.main,
width: "40%",
2025-03-04 00:58:59 +05:30
mb: theme.spacing(2),
mt: theme.spacing(2),
pr: theme.spacing(2),
2025-05-27 09:10:32 -07:00
textAlign: "right",
};
2025-03-01 10:21:39 +05:30
2025-01-31 13:43:57 -08:00
return (
<BaseContainer>
<Stack
direction="column"
gap={theme.spacing(2)}
alignItems="center"
>
2025-03-01 10:21:39 +05:30
<Box
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
width: "100%",
2025-05-27 09:10:32 -07:00
backgroundColor: theme.palette.gradient.color1,
2025-03-01 10:21:39 +05:30
}}
>
<CustomGauge
progress={value}
radius={100}
/>
2025-05-27 09:10:32 -07:00
<Typography
component="h2"
sx={{ fontWeight: 600 }}
>
{heading}
</Typography>
2025-03-01 10:21:39 +05:30
</Box>
2025-01-31 13:43:57 -08:00
<Box
sx={{
width: "100%",
borderTop: `1px solid ${theme.palette.primary.lowContrast}`,
}}
>
<Stack
justifyContent={"space-between"}
direction="row"
2025-03-01 10:21:39 +05:30
alignItems="center"
2025-01-31 13:43:57 -08:00
gap={theme.spacing(2)}
>
<Typography>{metricOne}</Typography>
2025-03-04 00:58:59 +05:30
<Typography sx={valueStyle}>{valueOne}</Typography>
2025-01-31 13:43:57 -08:00
</Stack>
<Stack
justifyContent={"space-between"}
direction="row"
2025-03-01 10:21:39 +05:30
alignItems="center"
2025-01-31 13:43:57 -08:00
gap={theme.spacing(2)}
>
<Typography>{metricTwo}</Typography>
2025-03-04 00:58:59 +05:30
<Typography sx={valueStyle}>{valueTwo}</Typography>
2025-01-31 13:43:57 -08:00
</Stack>
</Box>
</Stack>
</BaseContainer>
);
};
Gauge.propTypes = {
value: PropTypes.number,
heading: PropTypes.string,
metricOne: PropTypes.string,
valueOne: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
metricTwo: PropTypes.string,
valueTwo: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
};
export default Gauge;