diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js
index 5257ff0e9..bbe83b62b 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js
@@ -1,13 +1,9 @@
import { Source } from "@hurumap/next";
-import { Tooltip, Typography, LinearProgress } from "@mui/material";
-import clsx from "clsx";
+import { Tooltip, Typography, LinearProgress, Box } from "@mui/material";
import PropTypes from "prop-types";
import React from "react";
-import useStyles from "./useStyles";
-
function KeyMetric({
- className,
formattedValue: formattedValueProp,
value: valueProp,
title,
@@ -17,10 +13,8 @@ function KeyMetric({
parentName,
parentFormattedValue,
metadata: { source, url } = {},
- ...props
+ sx,
}) {
- const classes = useStyles(props);
-
if (!((valueProp || formattedValueProp) && title)) {
return null;
}
@@ -33,13 +27,37 @@ function KeyMetric({
const tooltipTitle = `${title}: ${formattedValue}`;
return (
-
-
+ ({
+ width: "100%",
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "space-between",
+ marginBottom: typography.pxToRem(20),
+ ...sx,
+ })}
+ >
+ ({
+ backgroundColor: palette.background.paper,
+ padding: `${typography.pxToRem(10)} ${typography.pxToRem(
+ 20,
+ )} ${typography.pxToRem(14)} ${typography.pxToRem(20)}`,
+ })}
+ >
{formattedValue}
({
+ fontSize: typography.pxToRem(11),
+ overflow: "hidden",
+ display: "-webkit-box",
+ WebkitLineClamp: 1,
+ WebkitBoxOrient: "vertical",
+ textOverflow: "ellipsis",
+ marginBottom: typography.pxToRem(8),
+ })}
>
{title}
@@ -48,20 +66,25 @@ function KeyMetric({
sensitivity: "accent",
}) === 0 ? (
({
+ "&.MuiLinearProgress-determinate": {
+ backgroundColor: palette.grey.main,
+ },
+ })}
value={parseFloat(`${value}`.replace(",", ""))}
color={color}
variant="determinate"
/>
) : null}
-
+
{parentValue && (
({
+ fontSize: typography.pxToRem(11),
+ padding: `${typography.pxToRem(6)} 0 0 ${typography.pxToRem(20)}`,
+ color: "#666666",
+ })}
>
{parentValue}
@@ -74,12 +97,11 @@ function KeyMetric({
>
{source}
-
+
);
}
KeyMetric.propTypes = {
- className: PropTypes.string,
color: PropTypes.string,
description: PropTypes.string,
displayFormat: PropTypes.string,
diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/useStyles.js
deleted file mode 100644
index 035b5d260..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/useStyles.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ typography, palette }) => ({
- root: {
- width: "100%",
- display: "flex",
- flexDirection: "column",
- justifyContent: "space-between",
- marginBottom: typography.pxToRem(20),
- },
- metric: {
- backgroundColor: palette.background.paper,
- padding: `${typography.pxToRem(10)} ${typography.pxToRem(
- 20,
- )} ${typography.pxToRem(14)} ${typography.pxToRem(20)}`,
- },
-
- progressBar: {},
- progressBarDeterminate: {
- backgroundColor: palette.grey.main,
- },
- text: {
- fontSize: typography.pxToRem(11),
- },
- title: {
- overflow: "hidden",
- display: "-webkit-box",
- WebkitLineClamp: 1,
- WebkitBoxOrient: "vertical",
- textOverflow: "ellipsis",
- marginBottom: typography.pxToRem(8),
- },
- description: {
- padding: `${typography.pxToRem(6)} 0 0 ${typography.pxToRem(20)}`,
- color: "#666666",
- },
-}));
-
-export default useStyles;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js
index 09342406a..e7562f518 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js
@@ -132,11 +132,11 @@ const ProfileItems = memo(
value={value}
displayFormat={displayFormat}
metadata={metadata}
- classes={{
- root: clsx({
- [classes.secondaryMetric]: secondaryProfile,
- }),
- }}
+ sx={({ typography }) => ({
+ maxWidth: {
+ lg: typography.pxToRem(350),
+ },
+ })}
/>
{secondaryMetric && (
@@ -152,7 +152,11 @@ const ProfileItems = memo(
value={secondaryValue}
displayFormat={secondaryDisplayFormat}
metadata={secondaryMetric.metric}
- className={classes.secondaryMetric}
+ sx={({ typography }) => ({
+ maxWidth: {
+ lg: typography.pxToRem(350),
+ },
+ })}
/>
)}