fix: changing spacing to constants

This commit is contained in:
mannilakash committed 2026-03-13 12:07:14 -04:00
1 parent 22bcb74653
commit d1077a1314
2 files changed
+17 -16

No files matched your search

@@ -8,6 +8,7 @@ import type { Monitor } from "@/Types/Monitor";
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
interface StatusPageMonitor extends Monitor { interface StatusPageMonitor extends Monitor {
checks?: Monitor["recentChecks"]; checks?: Monitor["recentChecks"];
@@ -56,15 +57,14 @@ const MetricItem = ({ label, progress, details }: MetricItemProps) => {
flexDirection: "column", flexDirection: "column",
alignItems: "center", alignItems: "center",
textAlign: "center", textAlign: "center",
gap: theme.spacing(2), gap: theme.spacing(SPACING.LG),
padding: theme.spacing(2), padding: theme.spacing(LAYOUT.XS),
paddingBottom: theme.spacing(4),
borderRight: isSmall ? "none" : `1px solid ${theme.palette.divider}`, borderRight: isSmall ? "none" : `1px solid ${theme.palette.divider}`,
borderBottom: isSmall ? `1px solid ${theme.palette.divider}` : "none", borderBottom: isSmall ? `1px solid ${theme.palette.divider}` : "none",
"&:last-child": { "&:last-child": {
borderRight: "none", borderRight: "none",
borderBottom: "none", borderBottom: "none",
paddingBottom: theme.spacing(2), paddingBottom: theme.spacing(SPACING.LG),
}, },
}} }}
> >
@@ -83,7 +83,7 @@ const MetricItem = ({ label, progress, details }: MetricItemProps) => {
{details && details.length > 0 && ( {details && details.length > 0 && (
<Box <Box
width="100%" width="100%"
paddingX={theme.spacing(10)} paddingX={theme.spacing(LAYOUT.LG)}
> >
{details.map((detail) => ( {details.map((detail) => (
<MetricDetailRow <MetricDetailRow
@@ -182,7 +182,7 @@ export const InfrastructureMetrics = ({ monitor }: { monitor: StatusPageMonitor
<Grid <Grid
container container
alignItems="center" alignItems="center"
padding={theme.spacing(4)} padding={theme.spacing(LAYOUT.XS)}
> >
{metrics.map( {metrics.map(
({ key, labelKey, hasData, progress, details }) => ({ key, labelKey, hasData, progress, details }) =>
@@ -13,6 +13,7 @@ import { useState } from "react";
import type { Monitor } from "@/Types/Monitor"; import type { Monitor } from "@/Types/Monitor";
import type { StatusPage } from "@/Types/StatusPage"; import type { StatusPage } from "@/Types/StatusPage";
import type { RootState } from "@/Types/state"; import type { RootState } from "@/Types/state";
import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
interface StatusPageMonitor extends Monitor { interface StatusPageMonitor extends Monitor {
checks?: Monitor["recentChecks"]; checks?: Monitor["recentChecks"];
@@ -60,7 +61,7 @@ const getMonitorBadgeStyles = (monitorType: string, theme: Theme) => {
return { return {
backgroundColor: config.bg, backgroundColor: config.bg,
color: config.color, color: config.color,
padding: `${theme.spacing(1)} ${theme.spacing(2)}`, padding: `${theme.spacing(SPACING.SM)} ${theme.spacing(SPACING.LG)}`,
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
}; };
}; };
@@ -90,11 +91,11 @@ const MonitorContent = ({
} }
return ( return (
<Box sx={{ overflow: "hidden", minWidth: 0, flex: 1, mb: theme.spacing(2) }}> <Box sx={{ overflow: "hidden", minWidth: 0, flex: 1, mb: theme.spacing(SPACING.LG) }}>
{chartType === "histogram" ? ( {chartType === "histogram" ? (
<HistogramResponseTime <HistogramResponseTime
height={{ xs: 50, md: 100 }} height={{ xs: 50, md: 100 }}
gap={{ xs: theme.spacing(1), md: theme.spacing(5) }} gap={{ xs: theme.spacing(SPACING.SM), md: theme.spacing(LAYOUT.SM) }}
checks={monitor?.checks?.slice().reverse() ?? []} checks={monitor?.checks?.slice().reverse() ?? []}
/> />
) : ( ) : (
@@ -113,12 +114,12 @@ export const MonitorsList = ({ statusPage, monitors }: MonitorsListProps) => {
const [chartType, setChartType] = useState<"histogram" | "heatmap">("histogram"); const [chartType, setChartType] = useState<"histogram" | "heatmap">("histogram");
return ( return (
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
{statusPage.showCharts && ( {statusPage.showCharts && (
<Stack <Stack
direction={"row"} direction={"row"}
alignItems={"center"} alignItems={"center"}
gap={theme.spacing(2)} gap={theme.spacing(LAYOUT.SM)}
> >
<Typography>{t("pages.statusPages.monitorsList.chartTypeHeatmap")}</Typography> <Typography>{t("pages.statusPages.monitorsList.chartTypeHeatmap")}</Typography>
<SwitchComponent <SwitchComponent
@@ -139,21 +140,21 @@ export const MonitorsList = ({ statusPage, monitors }: MonitorsListProps) => {
return ( return (
<BaseBox <BaseBox
key={monitor.id} key={monitor.id}
padding={theme.spacing(8)} padding={theme.spacing(LAYOUT.MD)}
> >
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
justifyContent="space-between" justifyContent="space-between"
gap={theme.spacing(4)} gap={theme.spacing(LAYOUT.XS)}
mb={theme.spacing(4)} mb={theme.spacing(LAYOUT.XS)}
> >
<Box sx={{ overflow: "hidden", minWidth: 0, flex: 1 }}> <Box sx={{ overflow: "hidden", minWidth: 0, flex: 1 }}>
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
gap={theme.spacing(2)} gap={theme.spacing(SPACING.LG)}
mb={theme.spacing(1)} mb={theme.spacing(SPACING.SM)}
> >
<Typography <Typography
variant="h6" variant="h6"