Files
Checkmate/client/src/Components/design-elements/BaseChart.tsx
T

50 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-02-20 18:13:39 +00:00
import { BaseBox } from ".";
2026-01-25 16:31:54 +00:00
import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
2026-02-28 16:16:14 +00:00
import { LAYOUT } from "@/Utils/Theme/constants";
2026-01-25 16:31:54 +00:00
import type { ResponsiveStyleValue } from "@mui/system";
import { useTheme } from "@mui/material/styles";
type BaseChartProps = React.PropsWithChildren<{
icon?: React.ReactNode;
2026-01-25 16:31:54 +00:00
title: string;
width?: number | string;
maxWidth?: number | string;
padding?: number | string | ResponsiveStyleValue<number | string>;
}>;
export const BaseChart = ({
children,
title,
width = "100%",
maxWidth = "100%",
padding,
}: BaseChartProps) => {
const theme = useTheme();
return (
<BaseBox
sx={{
2026-02-28 16:16:14 +00:00
padding: padding ?? theme.spacing(LAYOUT.MD),
2026-01-25 16:31:54 +00:00
display: "flex",
flex: 1,
width: width,
maxWidth: maxWidth,
}}
>
<Stack
2026-02-28 16:16:14 +00:00
gap={theme.spacing(LAYOUT.MD)}
2026-01-25 16:31:54 +00:00
flex={1}
>
<Typography
variant="eyebrow"
color="text.secondary"
2026-01-25 16:31:54 +00:00
>
{title}
</Typography>
2026-01-25 16:31:54 +00:00
<Box flex={1}>{children}</Box>
</Stack>
</BaseBox>
);
};