Files
Checkmate/client/src/components/monitors/Chart.tsx
T

63 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-11-13 13:47:26 -08:00
import { BaseBox } from "../design-elements";
import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import { useTheme } from "@mui/material/styles";
type BaseChartProps = React.PropsWithChildren<{
icon: React.ReactNode;
title: string;
width?: number | string;
maxWidth?: number | string;
}>;
export const BaseChart: React.FC<BaseChartProps> = ({
children,
icon,
title,
width = "100%",
maxWidth = "100%",
}) => {
const theme = useTheme();
return (
<BaseBox
sx={{
padding: theme.spacing(8),
display: "flex",
flex: 1,
width: width,
maxWidth: maxWidth,
}}
>
<Stack gap={theme.spacing(8)} flex={1}>
<Stack direction="row" alignItems={"center"} gap={theme.spacing(4)}>
{icon && (
<BaseBox
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
width: 34,
height: 34,
2025-12-08 19:55:29 +00:00
backgroundColor: theme.palette.action.hover,
2025-11-13 13:47:26 -08:00
"& svg": {
width: 20,
height: 20,
"& path": {
2025-12-08 19:55:29 +00:00
stroke: theme.palette.text.secondary,
2025-11-13 13:47:26 -08:00
},
},
}}
>
{icon}
</BaseBox>
)}
<Typography variant="h2">{title}</Typography>
</Stack>
<Box flex={1}>{children}</Box>
</Stack>
</BaseBox>
);
};