diff --git a/apps/climatemappedafrica/src/assets/icons/x-logo.svg b/apps/climatemappedafrica/src/assets/icons/x-logo.svg
new file mode 100644
index 000000000..5526e4215
--- /dev/null
+++ b/apps/climatemappedafrica/src/assets/icons/x-logo.svg
@@ -0,0 +1 @@
+
diff --git a/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js b/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js
index a354b90d0..2884d8752 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/index.js
@@ -1,32 +1,54 @@
-import { RichTypography } from "@commons-ui/legacy";
-import { Typography } from "@mui/material";
+import { Box, Typography } from "@mui/material";
import PropTypes from "prop-types";
import React from "react";
-import useStyles from "./useStyles";
-
-import Image from "@/climatemappedafrica/components/Image";
-
function CategoryHeader({ title, description, icon, ...props }) {
- const classes = useStyles();
-
if (!title) {
return null;
}
return (
-
-
+
+ ({
+ fontSize: typography.pxToRem(28),
+ display: "flex",
+ alignItems: "center",
+ scrollMarginTop: typography.pxToRem(110),
+ paddingTop: typography.pxToRem(40),
+ paddingBottom: typography.pxToRem(20),
+ })}
+ >
{icon && (
-
-
-
+ ({
+ position: "relative",
+ height: typography.pxToRem(32),
+ width: typography.pxToRem(32),
+ marginRight: typography.pxToRem(10),
+ backgroundImage: `url(${icon})`,
+ backgroundSize: "contain",
+ backgroundRepeat: "no-repeat",
+ })}
+ />
)}
{title}
-
- {description}
-
-
+ {description && (
+ ({
+ paddingBottom: typography.pxToRem(20),
+ "& p": {
+ margin: 0,
+ },
+ })}
+ >
+ {description}
+
+ )}
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/useStyles.js
deleted file mode 100644
index af084f80a..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/CategoryHeader/useStyles.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ typography }) => ({
- root: {},
- title: {
- fontSize: typography.pxToRem(28),
- display: "flex",
- alignItems: "center",
- scrollMarginTop: typography.pxToRem(110),
- paddingTop: typography.pxToRem(40),
- paddingBottom: typography.pxToRem(20),
- },
- description: {
- paddingBottom: typography.pxToRem(20),
- "& p": {
- margin: 0,
- },
- },
- icon: {
- position: "relative",
- height: typography.pxToRem(32),
- width: typography.pxToRem(32),
- marginRight: typography.pxToRem(10),
- },
-}));
-
-export default useStyles;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js
index 17827fdfa..68551c9f4 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/Filters.js
@@ -1,5 +1,4 @@
-import { ButtonBase } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
+import { Box, ButtonBase } from "@mui/material";
import PropTypes from "prop-types";
import React, { useEffect, useState, useCallback } from "react";
@@ -7,21 +6,13 @@ import { idify } from "./utils";
import ChartFilter from "@/climatemappedafrica/components/HURUmap/ChartFilter";
-const useStyles = makeStyles(({ typography }) => ({
- root: {
- paddingBottom: typography.pxToRem(18),
- },
-}));
-
function Filters({
filterGroups,
defaultFilters,
filterSelectProps,
setFilterSelectProps,
view,
- ...props
}) {
- const classes = useStyles(props);
const [availableGroups, setAvailableGroups] = useState([]);
const handleFilterSelectProps = (v) => {
@@ -122,7 +113,11 @@ function Filters({
}
return (
-
+ ({
+ paddingBottom: typography.pxToRem(18),
+ })}
+ >
{
// default filters cannot be deleted
// & their attributes cannot be changes, but values can
@@ -149,7 +144,7 @@ function Filters({
{availableGroups?.length > 0 && (
Add new filter
)}
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
index 5a048f711..ba7f1a382 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
@@ -1,8 +1,7 @@
import { RichTypography } from "@commons-ui/legacy";
import { ChartTooltip, IndicatorTitle, Download, Share } from "@hurumap/core";
import { Source } from "@hurumap/next";
-import { useMediaQuery, useTheme } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
+import { Box, useMediaQuery, useTheme } from "@mui/material";
import React, { useState, useRef, useCallback, useEffect } from "react";
import * as vega from "vega";
import embed from "vega-embed";
@@ -18,26 +17,13 @@ import FacebookIcon from "@/climatemappedafrica/assets/icons/Facebook.svg";
import LinkedInIcon from "@/climatemappedafrica/assets/icons/LinkedIn.svg";
import InfoIcon from "@/climatemappedafrica/assets/icons/plus.svg";
import ShareIcon from "@/climatemappedafrica/assets/icons/share.svg";
-import TwitterIcon from "@/climatemappedafrica/assets/icons/Twitter.svg";
import WhatsAppIcon from "@/climatemappedafrica/assets/icons/WhatsApp.svg";
+import XLogo from "@/climatemappedafrica/assets/icons/x-logo.svg";
import cfalogo from "@/climatemappedafrica/assets/logos/cfa.svg";
import projectlogo from "@/climatemappedafrica/assets/logos/projectLogo.svg";
import config, { hurumapArgs } from "@/climatemappedafrica/config";
import site from "@/climatemappedafrica/utils/site";
-const useStyles = makeStyles(({ typography }) => ({
- root: {
- position: "relative",
- width: "100%",
- "&:last-of-type": {
- marginBottom: typography.pxToRem(32),
- },
- },
- chart: {
- width: "100%",
- },
-}));
-
function Chart({
indicator,
indicatorTitle,
@@ -48,7 +34,6 @@ function Chart({
isCompare,
...props
}) {
- const classes = useStyles(props);
const chartRef = useRef();
const tooltipRef = useRef();
const [view, setView] = useState(null);
@@ -228,7 +213,7 @@ function Chart({
},
{
name: "Twitter",
- icon: TwitterIcon,
+ icon: XLogo,
props: { title, via: "Code4Africa", related: ["Code4Africa"] },
},
{
@@ -328,7 +313,16 @@ function Chart({
];
return (
-
+
({
+ position: "relative",
+ width: "100%",
+ "&:last-of-type": {
+ marginBottom: typography.pxToRem(32),
+ },
+ })}
+ >
)}
-
+
({
@@ -393,7 +392,7 @@ function Chart({
}
/>
)}
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js b/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js
index e986d16f4..c54b4a642 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/index.js
@@ -1,9 +1,7 @@
-import { Grid, IconButton } from "@mui/material";
+import { Box, Grid, IconButton, useTheme } from "@mui/material";
import PropTypes from "prop-types";
import React, { useEffect, useState } from "react";
-import useStyles from "./useStyles";
-
import CloseIcon from "@/climatemappedafrica/assets/icons/x.svg";
import Select from "@/climatemappedafrica/components/Select";
@@ -17,10 +15,7 @@ function ChartFilter({
valueText = "Select a value:",
selectedAttribute: selectedAttributeProp,
selectedValue: selectedValueProp,
- ...props
}) {
- const classes = useStyles(props);
-
const [selectedAttribute, setSelectedAttribute] = useState(
selectedAttributeProp,
);
@@ -29,6 +24,8 @@ function ChartFilter({
const [attributeOptions, setAttributeOptions] = useState([]);
const [valueOptions, setValueOptions] = useState([]);
+ const theme = useTheme();
+
useEffect(() => {
if (index === "default") {
setAttributeOptions([selectedAttribute]);
@@ -86,36 +83,75 @@ function ChartFilter({
}
return (
-
+ ({
+ paddingBottom: typography.pxToRem(10),
+ })}
+ >
{attributeOptions?.length > 0 && (
-
+ ({
+ marginRight: { md: typography.pxToRem(10) },
+ })}
+ >
)}
{valueOptions?.length > 0 && (
-
+ ({
+ marginRight: { md: typography.pxToRem(10) },
+ })}
+ >
@@ -123,7 +159,15 @@ function ChartFilter({
{index !== "default" && index !== 0 && (
({
+ padding: 0,
+ background: palette.background.paper,
+ "& :hover": {
+ background: palette.background.paper,
+ },
+ height: typography.pxToRem(36),
+ width: typography.pxToRem(36),
+ })}
onClick={removeFilter}
size="large"
>
@@ -132,7 +176,7 @@ function ChartFilter({
)}
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/useStyles.js
deleted file mode 100644
index 1a6c85531..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/ChartFilter/useStyles.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ breakpoints, typography, palette }) => ({
- root: {
- paddingBottom: typography.pxToRem(10),
- },
- grid: {
- [breakpoints.up("md")]: {
- marginRight: typography.pxToRem(10),
- },
- },
- icon: {
- padding: 0,
- background: palette.background.paper,
- "& :hover": {
- background: palette.background.paper,
- },
- height: typography.pxToRem(36),
- width: typography.pxToRem(36),
- },
- select: {
- width: typography.pxToRem(165),
- height: typography.pxToRem(40),
- paddingLeft: 0,
- [breakpoints.up("lg")]: {
- width: typography.pxToRem(200),
- },
- },
- filled: {
- padding: `${typography.pxToRem(10)} ${typography.pxToRem(
- 40,
- )} ${typography.pxToRem(10)} ${typography.pxToRem(20)} !important`,
- },
- selectPaper: {
- maxHeight: typography.pxToRem(310),
- },
-}));
-
-export default useStyles;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js b/apps/climatemappedafrica/src/components/HURUmap/KeyMetric/index.js
index 5257ff0e9..d2cca6a5f 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, Grid } 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%",
+ 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/LocationHeader/index.js b/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js
index ca10402df..1f473d41b 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/index.js
@@ -1,4 +1,5 @@
import {
+ Box,
Button,
Grid,
IconButton,
@@ -8,8 +9,6 @@ import {
import PropTypes from "prop-types";
import React from "react";
-import useStyles from "./useStyles";
-
import CloseIcon from "@/climatemappedafrica/assets/icons/closeBlack.svg";
import Image from "@/climatemappedafrica/components/Image";
import slugify from "@/climatemappedafrica/utils/slugify";
@@ -18,19 +17,37 @@ function SvgIcon(props) {
return ;
}
-function LocationHeader({ icon, level, onClick, parent, title, ...props }) {
- const classes = useStyles(props);
-
+function LocationHeader({ icon, level, onClick, parent, title }) {
if (!title) {
return null;
}
return (
-
+
({
+ borderBottom: `solid 1px ${palette.divider}`,
+ paddingTop: typography.pxToRem(20),
+ position: {
+ lg: "relative",
+ },
+ })}
+ >
-
+ ({
+ borderBottom: ({ variant }) =>
+ `solid 5px ${
+ variant === "secondary"
+ ? palette.secondary.main
+ : palette.primary.main
+ }`,
+ marginBottom: typography.pxToRem(20),
+ })}
+ >
{title}
@@ -38,14 +55,28 @@ function LocationHeader({ icon, level, onClick, parent, title, ...props }) {
({
+ marginLeft: typography.pxToRem(20),
+ maxHeight: typography.pxToRem(44),
+ maxWidth: typography.pxToRem(44),
+ overflow: "hidden",
+ padding: 0,
+ })}
size="large"
>
({
+ color: palette.grey.light,
+ "&:hover": {
+ color: "#666",
+ "& .Component_108-1_svg__b": {
+ stroke: palette.common.white,
+ },
+ },
+ })}
/>
@@ -54,20 +85,47 @@ function LocationHeader({ icon, level, onClick, parent, title, ...props }) {
{icon ? (
-
) : null}
{parent && (
-
+ ({
+ textTransform: "uppercase",
+ borderBottom: `solid 1px ${palette.divider}`,
+ paddingBottom: typography.pxToRem(10),
+ })}
+ >
{`A ${level} in ${parent}`}
)}
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/useStyles.js
deleted file mode 100644
index 2f17071f0..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/LocationHeader/useStyles.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ breakpoints, palette, typography }) => ({
- root: {
- borderBottom: `solid 1px ${palette.divider}`,
- paddingTop: typography.pxToRem(20),
- [breakpoints.up("lg")]: {
- position: "relative",
- },
- },
- titleContent: {
- display: "flex",
- justifyContent: "space-between",
- },
- title: {
- borderBottom: ({ variant }) =>
- `solid 5px ${
- variant === "secondary" ? palette.secondary.main : palette.primary.main
- }`,
- marginBottom: typography.pxToRem(20),
- },
- description: {
- textTransform: "uppercase",
- borderBottom: `solid 1px ${palette.divider}`,
- paddingBottom: typography.pxToRem(10),
- },
- icon: {
- position: "relative",
- height: typography.pxToRem(20),
- minWidth: typography.pxToRem(20),
- },
- button: {
- borderRadius: "50%",
- backgroundColor: palette.grey.light,
- width: typography.pxToRem(44),
- height: typography.pxToRem(44),
- minWidth: typography.pxToRem(44),
- boxShadow: "none",
- [breakpoints.up("lg")]: {
- // quick fix to ensure print button aligns with rich data/pin buttons
- marginTop: "10px",
- },
- },
- closeButton: {
- marginLeft: typography.pxToRem(20),
- maxHeight: typography.pxToRem(44),
- maxWidth: typography.pxToRem(44),
- overflow: "hidden",
- padding: 0,
- },
- closeButtonIcon: {
- color: palette.grey.light,
- "&:hover": {
- color: "#666",
- "& .Component_108-1_svg__b": {
- stroke: palette.common.white,
- },
- },
- },
-}));
-
-export default useStyles;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/MobilePanel.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/MobilePanel.js
index 3fc789a10..8d07887ba 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/MobilePanel.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/MobilePanel.js
@@ -1,4 +1,4 @@
-import { Button, Typography } from "@mui/material";
+import { Button, Typography, useTheme } from "@mui/material";
import PropTypes from "prop-types";
import React from "react";
@@ -14,12 +14,11 @@ import { hurumapArgs } from "@/climatemappedafrica/config";
// being last is necessary for style override to work
// eslint-disable-next-line import/order
-import useStyles from "./useStyles";
function MobilePanel({ activeType, scrollToTopLabel, sx, ...props }) {
- const classes = useStyles(props);
const { onSelectLocation, primaryProfile, dataNotAvailable } = props;
const { geography, items } = primaryProfile;
+ const theme = useTheme();
const { pinAndCompare } = hurumapArgs;
@@ -85,13 +84,55 @@ function MobilePanel({ activeType, scrollToTopLabel, sx, ...props }) {
name="mobilepanel"
items={formatedItems}
activeTab={activeTab}
- classes={{
- divider: classes.tabsDivider,
- indicator: classes.tabIndicator,
- tabs: classes.tabs,
- tab: classes.tab,
- tabPanels: classes.tabPanels,
- tabSelected: classes.tabSelected,
+ DividerProps={{
+ display: "none",
+ }}
+ TabIndicatorProps={{
+ display: "none",
+ }}
+ TabPanelProps={{
+ marginTop: 0,
+ }}
+ TabsProps={{
+ paddingBottom: theme.typography.pxToRem(16),
+ paddingTop: theme.typography.pxToRem(16),
+ paddingLeft: {
+ xs: theme.typography.pxToRem(20),
+ md: theme.typography.pxToRem(80),
+ },
+ paddingRight: {
+ xs: theme.typography.pxToRem(20),
+ md: theme.typography.pxToRem,
+ },
+ backgroundColor: theme.palette.background.paper,
+ zIndex: theme.zIndex.appBar,
+ width: "100%",
+ position: "sticky",
+ top: 66, // below navbar
+ }}
+ TabProps={{
+ color: "#212529",
+ backgroundColor: theme.palette.background.default,
+ fontWeight: 500,
+ fontSize: theme.typography.pxToRem(12),
+ letterSpacing: theme.typography.pxToRem(1.6),
+ lineHeight: 30 / 12,
+ marginRight: theme.typography.pxToRem(20),
+ padding: `${theme.typography.pxToRem(6)} ${theme.typography.pxToRem(20)}`,
+ height: theme.typography.pxToRem(29),
+ maxWidth: "unset",
+ textTransform: "unset",
+ "&:last-of-type": {
+ marginRight: 0,
+ },
+ "&.Mui-selected": {
+ color: theme.palette.background.default,
+ backgroundColor: "#666666",
+ },
+ "&:hover, &:focus, &$selected": {
+ color: theme.palette.background.default,
+ backgroundColor: "#666666",
+ },
}}
/>
{items?.length > 0 && (
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/useStyles.js
deleted file mode 100644
index 5dd914e38..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/Panel/MobilePanel/useStyles.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-// We can't migrate these styles to sx until components/Tabs is upgraded
-const useStyles = makeStyles(
- ({ typography, palette, zIndex, breakpoints }) => ({
- tabs: {
- paddingBottom: typography.pxToRem(16),
- paddingTop: typography.pxToRem(16),
- paddingLeft: typography.pxToRem(20),
- paddingRight: typography.pxToRem(20),
- backgroundColor: palette.background.paper,
- zIndex: zIndex.appBar,
- width: "100%",
- position: "sticky",
- top: 66, // below navbar
- [breakpoints.up("md")]: {
- paddingLeft: typography.pxToRem(80),
- paddingRight: typography.pxToRem(80),
- },
- },
- tabsDivider: {
- display: "none",
- },
- tab: {
- color: "#212529",
- backgroundColor: palette.background.default,
- fontWeight: 500,
- fontSize: typography.pxToRem(12),
- letterSpacing: typography.pxToRem(1.6),
- lineHeight: 30 / 12,
- marginRight: typography.pxToRem(20),
- padding: `${typography.pxToRem(6)} ${typography.pxToRem(20)}`,
- height: typography.pxToRem(29),
- maxWidth: "unset",
- textTransform: "unset",
- "&:last-of-type": {
- marginRight: 0,
- },
- },
- tabIndicator: {
- display: "none",
- },
- tabPanels: {
- marginTop: 0,
- },
- tabSelected: {
- "&.Mui-selected": {
- color: palette.background.default,
- },
- backgroundColor: "#666666",
- "&:hover, &:focus, &$selected": {
- color: palette.background.default,
- backgroundColor: "#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..88c1c86e8 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Panel/ProfileItems.js
@@ -1,6 +1,4 @@
import { Grid } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
-import clsx from "clsx";
import dynamic from "next/dynamic";
import PropTypes from "prop-types";
import React, { Fragment, memo } from "react";
@@ -20,33 +18,6 @@ const Chart = dynamic(
},
);
-const useStyles = makeStyles(({ typography, breakpoints }) => ({
- metrics: {
- marginTop: typography.pxToRem(24),
- },
- metricRow: {
- [breakpoints.up("lg")]: {
- marginBottom: typography.pxToRem(14),
- marginLeft: typography.pxToRem(18),
- maxWidth: typography.pxToRem(224),
- "&:first-of-type": {
- marginLeft: 0,
- },
- },
- },
- secondaryMetricRow: {
- [breakpoints.up("lg")]: {
- maxWidth: "100%",
- marginLeft: 0,
- },
- },
- secondaryMetric: {
- [breakpoints.up("lg")]: {
- maxWidth: typography.pxToRem(350),
- },
- },
-}));
-
const ProfileItems = memo(
function ProfileItems({
categories,
@@ -57,8 +28,6 @@ const ProfileItems = memo(
secondaryProfile,
geoCode,
}) {
- const classes = useStyles();
-
return (
<>
{categories.map((category, categoryIndex) => (
@@ -76,7 +45,12 @@ const ProfileItems = memo(
id={slugify(`${category.title}-${child.title}`)}
title={child.title}
/>
-
+ ({
+ marginTop: typography.pxToRem(24),
+ })}
+ >
{child?.metrics?.map(
(
{
@@ -116,8 +90,21 @@ const ProfileItems = memo(
container
lg={secondaryProfile ? 12 : 4}
key={label}
- className={clsx(classes.metricRow, {
- [classes.secondaryMetricRow]: secondaryProfile,
+ sx={({ typography }) => ({
+ marginBottom: {
+ lg: typography.pxToRem(14),
+ },
+ marginLeft: {
+ lg: secondaryProfile ? typography.pxToRem(18) : 0,
+ },
+ maxWidth: {
+ lg: secondaryProfile
+ ? typography.pxToRem(224)
+ : "100%",
+ },
+ "&:first-of-type": {
+ marginLeft: 0,
+ },
})}
>
@@ -132,11 +119,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 +139,11 @@ const ProfileItems = memo(
value={secondaryValue}
displayFormat={secondaryDisplayFormat}
metadata={secondaryMetric.metric}
- className={classes.secondaryMetric}
+ sx={({ typography }) => ({
+ maxWidth: {
+ lg: typography.pxToRem(350),
+ },
+ })}
/>
)}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js b/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js
index 1de16dbb2..f60a2d27f 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/index.js
@@ -1,4 +1,4 @@
-import { Box, IconButton, SvgIcon } from "@mui/material";
+import { Grid, IconButton, SvgIcon, alpha, useTheme } from "@mui/material";
import PropTypes from "prop-types";
import React, { useState } from "react";
@@ -6,10 +6,6 @@ import PinIconDefault from "@/climatemappedafrica/assets/pinBlack.svg";
import PinIconSelected from "@/climatemappedafrica/assets/pinSelected.svg";
import Select from "@/climatemappedafrica/components/Select";
-// useStyles uses import/definition order to determine how classes are ordered.
-// eslint-disable-next-line import/order
-import useStyles from "./useStyles";
-
function PinIcon(props) {
return ;
}
@@ -23,9 +19,8 @@ function PinAndCompare({
onClickPin,
onClose,
placeholder,
- ...props
}) {
- const classes = useStyles(props);
+ const theme = useTheme();
const [open, setOpen] = useState(false);
const [selected, setSelected] = useState(null);
const options = locations
@@ -67,11 +62,30 @@ function PinAndCompare({
const component = open ? PinIconSelected : PinIconDefault;
return (
-
+ ({
+ padding: `${typography.pxToRem(20)} 0`,
+ borderBottom: `solid 1px ${palette.divider}`,
+ })}
+ >
{!isMobile && (
({
+ maxHeight: typography.pxToRem(40),
+ maxWidth: typography.pxToRem(40),
+ overflow: "hidden",
+ padding: 0,
+ marginRight: typography.pxToRem(14),
+ backgroundColor: palette.grey.light,
+ borderRadius: "0px 2px 2px 0px",
+ boxShadow: `0px 3px 6px ${alpha(palette.common.black, 0.16)}`, // #00000029
+ "&:hover,&:focus,&:focus-within": {
+ backgroundColor: palette.grey.light,
+ },
+ })}
size="large"
>
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/useStyles.js
deleted file mode 100644
index ec69a427c..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/PinAndCompare/useStyles.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import { alpha } from "@mui/material/styles";
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ typography, palette }) => ({
- root: {
- padding: `${typography.pxToRem(20)} 0`,
- borderBottom: `solid 1px ${palette.divider}`,
- },
- pinButton: {
- maxHeight: typography.pxToRem(40),
- maxWidth: typography.pxToRem(40),
- overflow: "hidden",
- padding: 0,
- marginRight: typography.pxToRem(14),
- backgroundColor: palette.grey.light,
- borderRadius: "0px 2px 2px 0px",
- boxShadow: `0px 3px 6px ${alpha(palette.common.black, 0.16)}`, // #00000029
- "&:hover,&:focus,&:focus-within": {
- backgroundColor: palette.grey.light,
- },
- },
- locationSelect: {
- width: typography.pxToRem(205),
- height: typography.pxToRem(40),
- paddingLeft: 0,
- },
- filled: {
- padding: `${typography.pxToRem(10)} 0 ${typography.pxToRem(
- 10,
- )} ${typography.pxToRem(15)} !important`,
- },
- selectPaper: {
- height: typography.pxToRem(310),
- },
-}));
-
-export default useStyles;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js b/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js
index ba5067077..8f723bae9 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/SubcategoryHeader/index.js
@@ -1,50 +1,51 @@
-import { RichTypography } from "@commons-ui/legacy";
-import { Typography } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
+import { Box, Typography } from "@mui/material";
import PropTypes from "prop-types";
import React from "react";
-const useStyles = makeStyles(({ breakpoints, palette, typography }) => ({
- root: {
- borderBottom: `solid 1px ${palette.divider}`,
- borderTop: `solid 1px ${palette.divider}`,
- },
- title: {
- color: "#1c2030",
- fontWeight: 400,
- letterSpacing: typography.pxToRem(2),
- paddingBottom: typography.pxToRem(20),
- paddingTop: typography.pxToRem(20),
- // In mobile, we need to account for navbar + category tabs
- scrollMarginTop: typography.pxToRem(160),
- textTransform: "uppercase",
- [breakpoints.up("lg")]: {
- scrollMarginTop: typography.pxToRem(110),
- },
- },
- description: {
- paddingBottom: typography.pxToRem(20),
- "& p": {
- margin: 0,
- },
- },
-}));
-
function SubcategoryHeader({ title, description, ...props }) {
- const classes = useStyles(props);
-
if (!title) {
return null;
}
return (
-
-
+ ({
+ borderBottom: `solid 1px ${palette.divider}`,
+ borderTop: `solid 1px ${palette.divider}`,
+ })}
+ >
+ ({
+ color: "#1c2030",
+ fontWeight: 400,
+ letterSpacing: typography.pxToRem(2),
+ paddingBottom: typography.pxToRem(20),
+ paddingTop: typography.pxToRem(20),
+ // In mobile, we need to account for navbar + category tabs
+ scrollMarginTop: {
+ xs: typography.pxToRem(160),
+ lg: typography.pxToRem(110),
+ },
+ textTransform: "uppercase",
+ })}
+ >
{title}
-
- {description}
-
-
+ {description && (
+ ({
+ paddingBottom: typography.pxToRem(20),
+ "& p": {
+ margin: 0,
+ },
+ })}
+ >
+ {description}
+
+ )}
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/Line.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/Line.js
index d5b49488b..031a05865 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/Line.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/Line.js
@@ -1,18 +1,37 @@
+import { Box, useTheme } from "@mui/material";
import PropTypes from "prop-types";
import React from "react";
-import useStyles from "./useStyles";
-
-function Line({ x1, x2, y1, y2, ...props }) {
- const classes = useStyles(props);
+function Line({ x1, x2, y1, y2 }) {
+ const theme = useTheme();
return (
-
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js
index 1613f2e3f..2cf007a75 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js
@@ -1,46 +1,43 @@
import { RichText } from "@commons-ui/payload";
-import { Grid, Typography, IconButton, Avatar } from "@mui/material";
+import { Grid, Typography, IconButton, Avatar, Box } from "@mui/material";
import { useTour } from "@reactour/tour";
import PropTypes from "prop-types";
import React from "react";
-import useStyles from "./useStyles";
-
import CloseIcon from "@/climatemappedafrica/assets/icons/close.svg";
import Image from "@/climatemappedafrica/components/Image";
-function TutorialStep({ description, title, image, selector, ...props }) {
- const classes = useStyles(props);
+function TutorialStep({ description, title, image }) {
const { setIsOpen, currentStep } = useTour();
const handleClose = () => {
setIsOpen(false);
};
return (
-
+
({
+ paddingLeft: typography.pxToRem(34),
+ paddingTop: typography.pxToRem(25),
+ paddingRight: typography.pxToRem(39),
+ width: typography.pxToRem(964),
+ })}
+ >
({
+ marginBottom: typography.pxToRem(48),
+ })}
container
justifyContent="space-between"
alignItems="center"
>
-
+
{title}
{handleClose && (
-
+
@@ -49,7 +46,13 @@ function TutorialStep({ description, title, image, selector, ...props }) {
-
+ ({
+ background: palette.primary.main,
+ width: typography.pxToRem(48),
+ height: typography.pxToRem(48),
+ })}
+ >
{currentStep + 1}
@@ -74,16 +77,14 @@ function TutorialStep({ description, title, image, selector, ...props }) {
-
+
);
}
TutorialStep.propTypes = {
description: PropTypes.arrayOf(PropTypes.shape({})),
image: PropTypes.string,
- onClose: PropTypes.func,
title: PropTypes.string,
- selector: PropTypes.string,
};
export default TutorialStep;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/useStyles.js
deleted file mode 100644
index e6059fd98..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/useStyles.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ typography, palette }) => ({
- root: {
- paddingLeft: typography.pxToRem(34),
- paddingTop: typography.pxToRem(25),
- paddingRight: typography.pxToRem(39),
- width: typography.pxToRem(964),
- },
- header: {
- marginBottom: typography.pxToRem(48),
- },
- description: {
- marginLeft: typography.pxToRem(16),
- width: typography.pxToRem(278),
- lineHeight: 30 / 16,
- "& p": {
- marginTop: 0,
- marginBottom: typography.pxToRem(32),
- },
- },
- currentStep: {
- background: palette.primary.main,
- width: typography.pxToRem(48),
- height: typography.pxToRem(48),
- },
- title: {},
-}));
-
-export default useStyles;
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js
index 49f334e16..8d411070c 100644
--- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js
+++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/index.js
@@ -1,4 +1,4 @@
-import makeStyles from "@mui/styles/makeStyles";
+import { styled } from "@mui/material/styles";
import { TourProvider, useTour } from "@reactour/tour";
import PropTypes from "prop-types";
import React, { useState } from "react";
@@ -6,29 +6,22 @@ import React, { useState } from "react";
import Connector from "@/climatemappedafrica/components/HURUmap/Tutorial/Connector";
import TutorialStep from "@/climatemappedafrica/components/HURUmap/Tutorial/TutorialStep";
-const useStyles = makeStyles(({ typography, palette }) => ({
- tour: {
- width: typography.pxToRem(1000),
- maxWidth: "100vw !important",
- top: `${typography.pxToRem(200)} !important`,
- left: "50% !important",
- transform: "translateX(-50%) !important",
- paddingBottom: `${typography.pxToRem(48.62)} !important`,
- display: "flex",
- alignItems: "center",
- flexDirection: "column",
- border: `1px solid ${palette.primary.main}`,
- borderRadius: typography.pxToRem(10),
- "--reactour-accent": "#1C2030",
- },
- mask: {
- color: "#666666 !important",
- opacity: "0.5 !important",
- },
+const StyledTour = styled(TourProvider)(({ theme }) => ({
+ width: theme.typography.pxToRem(1000),
+ maxWidth: "100vw !important",
+ top: `${theme.typography.pxToRem(200)} !important`,
+ left: "50% !important",
+ transform: "translateX(-50%) !important",
+ paddingBottom: `${theme.typography.pxToRem(48.62)} !important`,
+ display: "flex",
+ alignItems: "center",
+ flexDirection: "column",
+ border: `1px solid ${theme.palette.primary.main}`,
+ borderRadius: theme.typography.pxToRem(10),
+ "--reactour-accent": "#1C2030",
}));
-function Tutorial({ children, defaultOpen = false, items, ...props }) {
- const classes = useStyles(props);
+function Tutorial({ children, defaultOpen = false, items }) {
const { setIsOpen } = useTour();
setIsOpen(defaultOpen);
@@ -42,7 +35,7 @@ function Tutorial({ children, defaultOpen = false, items, ...props }) {
};
return (
- ({
@@ -51,9 +44,13 @@ function Tutorial({ children, defaultOpen = false, items, ...props }) {
height: 16,
border: "2px solid #1C2030",
}),
+ maskWrapper: (base) => ({
+ ...base,
+ color: "#666666",
+ opacity: 0.5,
+ }),
}}
position="center"
- className={classes.tour}
showPrevNextButtons={false}
showBagde={false}
defaultOpen={defaultOpen}
@@ -61,8 +58,6 @@ function Tutorial({ children, defaultOpen = false, items, ...props }) {
beforeClose={setTourClosed}
showCloseButton={false}
accentColor="#fff"
- maskClassName={classes.mask}
- highlightedMaskClassName={classes.highlightedMask}
steps={items?.map((item, index) => ({
selector: item?.selector,
content: ,
@@ -70,7 +65,7 @@ function Tutorial({ children, defaultOpen = false, items, ...props }) {
>
{children}
{isOpened && }
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/useStyles.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/useStyles.js
deleted file mode 100644
index 8aafb717f..000000000
--- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/useStyles.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import makeStyles from "@mui/styles/makeStyles";
-
-const useStyles = makeStyles(({ typography, palette }) => ({
- root: {
- width: typography.pxToRem(964),
- },
- lineContainer: {
- position: "fixed",
- top: 0,
- bottom: 0,
- left: 0,
- right: 0,
- zIndex: 9999999,
- pointerEvents: "none",
- },
- line: {
- strokeWidth: typography.pxToRem(1),
- stroke: palette.primary.main,
- fill: palette.primary.main,
- },
-}));
-
-export default useStyles;
diff --git a/apps/climatemappedafrica/src/components/Select/index.js b/apps/climatemappedafrica/src/components/Select/index.js
index 2f951926a..4c2356952 100644
--- a/apps/climatemappedafrica/src/components/Select/index.js
+++ b/apps/climatemappedafrica/src/components/Select/index.js
@@ -7,13 +7,10 @@ import {
InputLabel,
Typography,
} from "@mui/material";
-import clsx from "clsx";
import { uniqueId } from "lodash";
import PropTypes from "prop-types";
import React, { useState } from "react";
-import useStyles from "./useStyles";
-
import ExpandMore from "@/climatemappedafrica/assets/icons/expand_more.svg";
function ExpandMoreIcon(props) {
@@ -21,6 +18,8 @@ function ExpandMoreIcon(props) {
}
function Input({
+ SelectProps,
+ MenuProps,
disabled,
helperText,
label: labelProp,
@@ -31,9 +30,7 @@ function Input({
options,
selected,
placeholder,
- ...props
}) {
- const classes = useStyles(props);
const [value, setValue] = useState();
const handleChange = (event) => {
setValue(event.target.value);
@@ -48,14 +45,44 @@ function Input({
variant="filled"
size="small"
disabled={disabled}
- className={classes.formControl}
+ sx={{
+ "& .MuiFilledInput-underline": {
+ "&::before": {
+ display: "none",
+ },
+ },
+ }}
>
{helperText ? (
- {helperText}
+ ({
+ fontSize: {
+ xs: typography.pxToRem(10),
+ },
+ fontWeight: "700",
+ color: "#666666",
+ textTransform: "uppercase",
+ marginLeft: 0,
+ marginBottom: typography.pxToRem(5),
+ })}
+ >
+ {helperText}
+
) : null}
{labelId ? (
-
-
+ ({
+ marginTop: typography.pxToRem(15),
+ })}
+ >
+
{labelProp}
@@ -71,10 +98,31 @@ function Input({
defaultValue={selected || ""}
IconComponent={ExpandMoreIcon}
MenuProps={{
- classes: {
- paper: classes.paper,
- list: classes.list,
- },
+ sx: ({ typography }) => ({
+ "& .MuiMenu-paper": {
+ borderBottomLeftRadius: 4,
+ borderBottomRightRadius: 4,
+ backgroundColor: "#F8F8F8",
+ marginTop: typography.pxToRem(5),
+ boxShadow: "none",
+ "&.MuiPaper-rounded": {
+ borderRadius: "0",
+ },
+ },
+ "& .MuiMenu-list": {
+ paddingTop: 0,
+ paddingBottom: 0,
+ "& li": {
+ fontWeight: 400,
+ paddingTop: typography.pxToRem(12),
+ paddingBottom: typography.pxToRem(12),
+ },
+ "& li.Mui-selected": {
+ fontWeight: "bold",
+ },
+ },
+ ...MenuProps,
+ }),
anchorOrigin: {
vertical: "bottom",
horizontal: "left",
@@ -86,13 +134,45 @@ function Input({
},
getContentAnchorEl: null,
}}
- classes={{
- root: classes.select,
- filled: clsx(classes.filled, { [classes.filledPlaceholder]: !value }),
- }}
+ sx={({ typography, palette }) => ({
+ width: {
+ sx: typography.pxToRem(135),
+ lg: typography.pxToRem(185),
+ },
+ background: palette.background.paper,
+ color: "#959696",
+ borderStyle: "none",
+ borderRadius: typography.pxToRem(2),
+ paddingBottom: typography.pxToRem(15),
+ paddingTop: typography.pxToRem(15),
+ fontSize: `${typography.caption.fontSize} !important`,
+ "&:focus": {
+ borderRadius: 2,
+ background: palette.background.paper,
+ borderColor: "none",
+ },
+ "&::before": {
+ display: "none",
+ },
+ "& .MuiSelect-filled": {
+ color: value ? "#959696" : "unset",
+ },
+ "& .MuiSelect-filled:focus": {
+ borderRadius: 0,
+ },
+ ...SelectProps,
+ })}
>
{placeholder ? (
-