diff --git a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx index 065f4e6fa..921ecdc02 100644 --- a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx +++ b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx @@ -2,6 +2,7 @@ import Tooltip from "@mui/material/Tooltip"; import Box from "@mui/material/Box"; import type { SxProps, Theme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; +import { mergeSx } from "@/Utils/mergeSx"; import type { ChartCell, HeatCellKind, @@ -19,10 +20,10 @@ export const ThemedHeatmap = ({ cells, containerSx, cellSx, onCellClick }: Props return ( @@ -31,10 +32,10 @@ export const ThemedHeatmap = ({ cells, containerSx, cellSx, onCellClick }: Props return ( { if (cell.date && onCellClick) { onCellClick(cell.date); @@ -51,10 +52,10 @@ export const ThemedHeatmap = ({ cells, containerSx, cellSx, onCellClick }: Props placement="top" > { if (cell.date && onCellClick) { diff --git a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx index 6f1b2fe1f..c8303e7e1 100644 --- a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx +++ b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHistogram.tsx @@ -5,6 +5,7 @@ import Stack from "@mui/material/Stack"; import type { SxProps, Theme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; import { formatMs } from "@/Utils/TimeUtils"; +import { mergeSx } from "@/Utils/mergeSx"; import type { BarKind, ChartCell, @@ -41,20 +42,20 @@ export const ThemedHistogram = ({ return ( {cells.map((cell) => { if (cell.barKind === "empty") { return ( { if (cell.date && onCellClick) { onCellClick(cell.date); @@ -71,10 +72,10 @@ export const ThemedHistogram = ({ placement="top" > { if (cell.date && onCellClick) { diff --git a/client/src/Utils/mergeSx.ts b/client/src/Utils/mergeSx.ts new file mode 100644 index 000000000..f85531f52 --- /dev/null +++ b/client/src/Utils/mergeSx.ts @@ -0,0 +1,6 @@ +import type { SxProps, Theme } from "@mui/material/styles"; + +export const mergeSx = (...styles: Array | false | null | undefined>): SxProps => + styles + .flatMap((style) => (Array.isArray(style) ? style : [style])) + .filter(Boolean) as SxProps;