Skip to content

Commit

Permalink
Revert unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinkipruto committed Nov 27, 2024
1 parent 69faa7c commit f69ca3e
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function DropdownSearch({
iconComponent = IconProp;
iconBorder = {
borderRadius: "50%",
border: "none",
border: "2px solid #fff",
};
}
const searchIconButton = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`<DropdownSearch /> renders unchanged 1`] = `
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-12ddcnt-MuiSvgIcon-root"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1ny0eu4-MuiSvgIcon-root"
focusable="false"
viewBox="0 0 48 48"
/>
Expand Down
49 changes: 5 additions & 44 deletions apps/climatemappedafrica/src/components/ExplorePage/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Location } from "@hurumap/core";
import { Map } from "@hurumap/next";
import { Box, useTheme } from "@mui/material";
import { useTheme } from "@mui/material";
import { useRouter } from "next/router";
import PropTypes from "prop-types";
import React, { useEffect, useState } from "react";

import useExplore from "./useExplore";
import useProfileGeography from "./useProfileGeography";
import useStyles from "./useStyles";

import Panel from "@/climatemappedafrica/components/HURUmap/Panel";

Expand Down Expand Up @@ -44,6 +45,7 @@ function ExplorePage({
rootGeographyHasData,
} = rootGeography;
const theme = useTheme();
const classes = useStyles(props);
// NOTE: This setState and the corresponding useEffect are "hacks" since at
// this point, useReducer hasn't been called yet so we can't use
// dispatch directly but we need handleClickTag for initializer.
Expand Down Expand Up @@ -158,48 +160,7 @@ function ExplorePage({
}
return (
<>
<Box
sx={({ palette, typography }) => ({
display: {
xs: "none",
lg: "flex",
},
height: "calc(100vh - 88px)",
position: "fixed",
left: 0,
right: 0,
"& .tooltipPop": {
background: palette.background.default,
boxShadow: "0px 3px 6px #00000029",
height: typography.pxToRem(36),
width: typography.pxToRem(88),
"& .level": {
background: palette.primary.main,
borderRadius: typography.pxToRem(4),
color: palette.text.secondary,
display: "flex",
fontSize: typography.pxToRem(7),
fontWeight: "bold",
height: typography.pxToRem(17),
justifyContent: "center",
lineHeight: 10 / 7,
margin: "0 auto",
marginTop: typography.pxToRem(-15),
paddingTop: typography.pxToRem(2),
textTransform: "uppercase",
width: typography.pxToRem(62),
},
"& .name": {
textAlign: "center",
fontSize: typography.pxToRem(9),
fontWeight: "bold",
lineHeight: 13 / 9,
marginTop: typography.pxToRem(5),
textTransform: "capitalize",
},
},
})}
>
<div className={classes.root}>
<Map
center={center}
geography={geography}
Expand Down Expand Up @@ -227,7 +188,7 @@ function ExplorePage({
},
}}
/>
</Box>
</div>
<Panel
{...props}
isCompare={state.isCompare}
Expand Down
46 changes: 46 additions & 0 deletions apps/climatemappedafrica/src/components/ExplorePage/useStyles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import makeStyles from "@mui/styles/makeStyles";

const useStyles = makeStyles(({ breakpoints, palette, typography }) => ({
root: {
display: "none",
[breakpoints.up("lg")]: {
display: "flex",
height: "calc(100vh - 88px)",
position: "fixed",
left: 0,
right: 0,
"& .tooltipPop": {
background: palette.background.default,
boxShadow: "0px 3px 6px #00000029",
height: typography.pxToRem(36),
width: typography.pxToRem(88),
"& .level": {
background: palette.primary.main,
borderRadius: typography.pxToRem(4),
color: palette.text.secondary,
display: "flex",
fontSize: typography.pxToRem(7),
fontWeight: "bold",
height: typography.pxToRem(17),
justifyContent: "center",
lineHeight: 10 / 7,
margin: "0 auto",
marginTop: typography.pxToRem(-15),
paddingTop: typography.pxToRem(2),
textTransform: "uppercase",
width: typography.pxToRem(62),
},
"& .name": {
textAlign: "center",
fontSize: typography.pxToRem(9),
fontWeight: "bold",
lineHeight: 13 / 9,
marginTop: typography.pxToRem(5),
textTransform: "capitalize",
},
},
},
},
}));

export default useStyles;
2 changes: 1 addition & 1 deletion apps/climatemappedafrica/src/components/Hero/Hero.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ exports[`<Hero /> renders unchanged 1`] = `
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-12ddcnt-MuiSvgIcon-root"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1ny0eu4-MuiSvgIcon-root"
focusable="false"
viewBox="0 0 48 48"
/>
Expand Down
20 changes: 12 additions & 8 deletions apps/climatemappedafrica/src/components/Loading/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { Box, CircularProgress } from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
import React from "react";

const useStyles = makeStyles(({ typography }) => ({
root: {},
box: {
justifyContent: "center",
height: typography.pxToRem(50),
},
}));

function Loading() {
const classes = useStyles();
return (
<Box
sx={({ typography }) => ({
display: "flex",
justifyContent: "center",
height: typography.pxToRem(50),
})}
>
<CircularProgress />
<Box sx={{ display: "flex" }} className={classes.box}>
<CircularProgress className={classes.progress} />
</Box>
);
}
Expand Down
16 changes: 2 additions & 14 deletions apps/climatemappedafrica/src/components/Menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ function Menu({ children, explorePagePath, links, socialLinks, ...props }) {
alignItems={{ lg: "center" }}
direction={{ xs: "column", lg: "row" }}
justifyContent={{ lg: "flex-end" }}
sx={{
padding: {
lg: 0,
},
}}
className={classes.root}
>
{links.map((item, index) => (
<Grid
Expand Down Expand Up @@ -133,15 +129,7 @@ function Menu({ children, explorePagePath, links, socialLinks, ...props }) {
<Typography
component="span"
variant="body1"
sx={({ typography }) => ({
fontWeight: 600,
letterSpacing: "1.6px",
fontSize: {
xs: typography.pxToRem(20),
lg: typography.pxToRem(16),
},
textTransform: "uppercase",
})}
className={classes.label}
>
{item.label}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Grid, Button } from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
import { useTour } from "@reactour/tour";
import PropTypes from "prop-types";
import React from "react";
Expand All @@ -7,6 +8,38 @@ import SearchIcon from "@/climatemappedafrica/assets/icons/search-explore.svg";
import DropdownSearch from "@/climatemappedafrica/components/DropdownSearch";
import NextImageButton from "@/climatemappedafrica/components/NextImageButton";

const useStyles = makeStyles(({ palette, typography }) => ({
searchLabel: {
display: "none",
},
searchInput: {
borderRadius: 0,
padding: `0 ${typography.pxToRem(10)}`,
color: "#959696",
textTransform: "initial",
"&::placeholder": {
opacity: 1,
},
},
searchInputRoot: {
borderRadius: 0,
backgroundColor: palette.background.paper,
borderColor: palette.background.default,
},
selectMenu: {
borderRadius: 0,
border: 0,
background: palette.background.paper,
marginTop: typography.pxToRem(2),
},
searchMenuItem: {
"&:hover": {
color: palette.text.secondary,
background: palette.primary.main,
},
},
}));

function ExploreNavigation({
explorePagePath,
locations,
Expand All @@ -15,6 +48,7 @@ function ExploreNavigation({
tutorialEnabled,
variant,
}) {
const classes = useStyles();
const { setIsOpen } = useTour();

const openTooltip = () => {
Expand Down Expand Up @@ -47,27 +81,12 @@ function ExploreNavigation({
placeholder="Search for a Location"
variant={variant}
locations={locations}
TypographyProps={{
display: "none",
}}
InputBaseProps={{
sx: ({ typography }) => ({
borderRadius: 0,
padding: `0 ${typography.pxToRem(10)}`,
color: "#959696",
textTransform: "initial",
"&::placeholder": {
opacity: 1,
},
}),
}}
IconButtonProps={{
sx: ({ palette, typography }) => ({
borderRadius: "50%",
border: 0,
background: palette.background.paper,
marginTop: typography.pxToRem(2),
}),
classes={{
inputRoot: classes.searchInputRoot,
input: classes.searchInput,
label: classes.searchLabel,
selectMenu: classes.selectMenu,
menuItem: classes.searchMenuItem,
}}
/>
{tutorialEnabled && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,8 @@ function MobileNavigation({
container
alignItems="center"
justifyContent="space-between"
sx={({ palette, typography }) => ({
borderBottom: `2px solid ${palette.background.default}`,
padding: `${typography.pxToRem(10)} 0`,
...sx,
})}
className={classes.logoSection}
sx={sx}
>
<Grid item xs={10}>
<NextImageButton
Expand Down Expand Up @@ -203,21 +200,13 @@ function MobileNavigation({
TransitionComponent={Transition}
classes={{ root: classes.dialog, paper: classes.dialogPaper }}
>
<DialogActions
sx={{
padding: 0,
}}
>
<DialogActions className={classes.dialogActions}>
<Section className={classes.section}>
<Grid
container
alignItems="center"
justifyContent="space-between"
sx={({ palette, typography }) => ({
borderBottom: `2px solid ${palette.background.default}`,
padding: `${typography.pxToRem(10)} 0`,
...sx,
})}
className={classes.logoSection}
>
<Grid item xs={10}>
<NextImageButton
Expand Down Expand Up @@ -250,12 +239,7 @@ function MobileNavigation({
</Grid>
</Section>
</DialogActions>
<DialogContent
sx={({ typography }) => ({
overflow: "hidden",
padding: `${typography.pxToRem(40)} 0`,
})}
>
<DialogContent className={classes.dialogContent}>
<Section className={classes.section}>
<Menu
explorePagePath={explorePagePath}
Expand Down

0 comments on commit f69ca3e

Please sign in to comment.