diff --git a/Client/src/Components/Charts/Gauge/index.jsx b/Client/src/Components/Charts/Gauge/index.jsx index febbe222b..e324a4dcc 100644 --- a/Client/src/Components/Charts/Gauge/index.jsx +++ b/Client/src/Components/Charts/Gauge/index.jsx @@ -7,8 +7,6 @@ const MAXIMUM_VALUE = 100 ; const DATA = [{ value: MAXIMUM_VALUE }]; const PROGRESS_THRESHOLD = 50; const DEFAULT_CONTAINER_HEIGHT = 160; -const DEFAULT_HEADER = { fontSize: "11px" }; -const DEFAULT_SUBHEADER = { fontSize: "9px" }; const TEXT_POSITIONS = { value: { x: "50%", y: "45%" }, label: { x: "50%", y: "55%" }, @@ -36,6 +34,11 @@ const RADIALBAR_OVERLAY_PROPS = { left: "0", }; +const COMMON_HEADER_PROPS = { + textAnchor: "middle", + dominantBaseline: "middle", +}; + const Gauge = ({ progressValue, displayText, @@ -44,8 +47,6 @@ const Gauge = ({ gaugeSubheader, }) => { const theme = useTheme(); - const header = gaugeHeader ?? DEFAULT_HEADER; - const subheader = gaugeSubheader ?? DEFAULT_SUBHEADER; const myProgressValue = Math.max(MINIMUM_VALUE, Math.min(progressValue, MAXIMUM_VALUE)); return ( @@ -73,7 +74,7 @@ const Gauge = ({ {...TEXT_POSITIONS.value} role="text" aria-label={`${myProgressValue}%`} - style={{ ...theme.palette.gaugeHeaderCommon, ...header }} + style={{...COMMON_HEADER_PROPS, ...theme.chart.header, ...gaugeHeader }} > {`${myProgressValue}%`} @@ -81,7 +82,7 @@ const Gauge = ({ {...TEXT_POSITIONS.label} role="text" aria-label={`${displayText}`} - style={{ ...theme.palette.gaugeHeaderCommon, ...subheader }} + style={{...COMMON_HEADER_PROPS, ...theme.chart.subheader, ...gaugeSubheader }} > {`${displayText}`} diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index ec5d352cd..72f7dba10 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -1,6 +1,5 @@ import { createTheme } from "@mui/material"; import { gaugeHeaderCommon } from "./lightTheme" -export { gaugeHeaderCommon } const text = { primary: "#fafafa", @@ -31,6 +30,16 @@ const darkTheme = createTheme({ body1: { fontSize: 13, color: text.tertiary, fontWeight: 400 }, body2: { fontSize: 12, color: text.tertiary, fontWeight: 400 }, }, + chart: { + header :{ + ...gaugeHeaderCommon, + fontSize: 11, + }, + subheader :{ + ...gaugeHeaderCommon, + fontSize: 9 + } + }, palette: { mode: "dark", primary: { main: "#1570ef" }, diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index ae61a35aa..8ea1e285b 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -15,9 +15,7 @@ const background = { export const gaugeHeaderCommon = { fontWeight: 400, - fill: text.tertiary, - textAnchor: "middle", - dominantBaseline: "middle", + fill: text.tertiary } const border = { light: "#eaecf0", dark: "#d0d5dd" }; @@ -36,11 +34,20 @@ const lightTheme = createTheme({ body1: { fontSize: 13, color: text.tertiary, fontWeight: 400 }, body2: { fontSize: 12, color: text.tertiary, fontWeight: 400 }, }, + chart: { + header :{ + ...gaugeHeaderCommon, + fontSize: 11, + }, + subheader :{ + ...gaugeHeaderCommon, + fontSize: 9 + } + }, palette: { primary: { main: "#1570EF" }, secondary: { main: "#F4F4F4", dark: "#e3e3e3", contrastText: "#475467" }, text: text, - gaugeHeaderCommon: gaugeHeaderCommon, background: background, border: border, info: {