Skip to content

Commit

Permalink
Merge pull request #783 from CodeForAfrica/ft/hurumap-location
Browse files Browse the repository at this point in the history
HURUMap Location
  • Loading branch information
kelvinkipruto authored Jul 22, 2024
2 parents 058afe0 + e7a12a5 commit 4032512
Show file tree
Hide file tree
Showing 18 changed files with 380 additions and 387 deletions.
4 changes: 3 additions & 1 deletion apps/climatemappedafrica/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"paths": {
"@/climatemappedafrica/*": ["./src/*"],
"@/commons-ui/core/*": ["../../packages/commons-ui-core/src/*"],
"@/commons-ui/next/*": ["../../packages/commons-ui-next/src/*"]
"@/commons-ui/next/*": ["../../packages/commons-ui-next/src/*"],
"@/hurumap/core/*": ["../../packages/hurumap-core/src/*"],
"@/hurumap/next/*": ["../../packages/hurumap-next/src/*"]
}
},
"exclude": ["node_modules"]
Expand Down
18 changes: 15 additions & 3 deletions apps/climatemappedafrica/src/components/ExplorePage/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Box } from "@mui/material";
import { Location } from "@hurumap/core";
import { Box, useTheme } from "@mui/material";
import dynamic from "next/dynamic";
import { useRouter } from "next/router";
import PropTypes from "prop-types";
Expand All @@ -9,7 +10,6 @@ import { primaryGeoStyles, secondaryGeoStyles } from "./useLayerStyles";
import useProfileGeography from "./useProfileGeography";
import useStyles from "./useStyles";

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

const Map = dynamic(
Expand All @@ -30,6 +30,7 @@ function initialState(profiles, onClick) {
}

function ExplorePage({ panelProps, profile: profileProp, ...props }) {
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
Expand Down Expand Up @@ -144,7 +145,18 @@ function ExplorePage({ panelProps, profile: profileProp, ...props }) {
highlights={highlights}
isLoading={isLoading}
tags={tags}
className={classes.location}
sx={{
display: "none",
[theme.breakpoints.up("md")]: {
display: "flex",
left: 0,
margin: "0 auto",
position: "absolute",
right: 0,
top: theme.typography.pxToRem(52),
zIndex: theme.zIndex.appBar,
},
}}
/>
</div>
</Box>
Expand Down
100 changes: 43 additions & 57 deletions apps/climatemappedafrica/src/components/ExplorePage/useStyles.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,52 @@
import makeStyles from "@mui/styles/makeStyles";

const useStyles = makeStyles(
({ breakpoints, palette, typography, zIndex }) => ({
root: {
position: "relative",
height: "calc(100vh - 88px)",
[breakpoints.up("lg")]: {
height: "calc(100vh - 110px)",
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",
},
},
},
map: {
display: "none",
[breakpoints.up("md")]: {
display: "block",
},
const useStyles = makeStyles(({ breakpoints, palette, typography }) => ({
root: {
position: "relative",
height: "calc(100vh - 88px)",
[breakpoints.up("lg")]: {
height: "calc(100vh - 110px)",
position: "fixed",
left: 0,
right: 0,
},
location: {
display: "none",
[breakpoints.up("md")]: {
"& .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",
left: 0,
fontSize: typography.pxToRem(7),
fontWeight: "bold",
height: typography.pxToRem(17),
justifyContent: "center",
lineHeight: 10 / 7,
margin: "0 auto",
position: "absolute",
right: 0,
top: typography.pxToRem(52),
zIndex: zIndex.appBar,
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",
},
},
}),
);
},
map: {
display: "none",
[breakpoints.up("md")]: {
display: "block",
},
},
}));

export default useStyles;
92 changes: 0 additions & 92 deletions apps/climatemappedafrica/src/components/HURUmap/Location/index.js

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions apps/pesayetu/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"paths": {
"@/commons-ui/core/*": ["../../packages/commons-ui-core/src/*"],
"@/commons-ui/next/*": ["../../packages/commons-ui-next/src/*"],
"@/hurumap/core/*": ["../../packages/hurumap-core/src/*"],
"@/hurumap/next/*": ["../../packages/hurumap-next/src/*"],
"@/pesayetu/*": ["./src/*"]
}
},
Expand Down
18 changes: 15 additions & 3 deletions apps/pesayetu/src/components/ExplorePage/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Box } from "@mui/material";
import { Location } from "@hurumap/core";
import { Box, useTheme } from "@mui/material";
import dynamic from "next/dynamic";
import { useRouter } from "next/router";
import PropTypes from "prop-types";
Expand All @@ -8,7 +9,6 @@ import useExplore from "./useExplore";
import useProfileGeography from "./useProfileGeography";
import useStyles from "./useStyles";

import Location from "@/pesayetu/components/HURUmap/Location";
import Panel from "@/pesayetu/components/HURUmap/Panel";

const Map = dynamic(() => import("@/pesayetu/components/HURUmap/Map"), {
Expand All @@ -26,6 +26,7 @@ function initialState(profiles, onClick) {
}

function ExplorePage({ panelProps, profile: profileProp, ...props }) {
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
Expand Down Expand Up @@ -138,7 +139,18 @@ function ExplorePage({ panelProps, profile: profileProp, ...props }) {
highlights={highlights}
isLoading={isLoading}
tags={tags}
className={classes.location}
sx={{
display: "none",
[theme.breakpoints.up("md")]: {
display: "flex",
left: 0,
margin: "0 auto",
position: "absolute",
right: 0,
top: theme.typography.pxToRem(52),
zIndex: theme.zIndex.appBar,
},
}}
/>
</div>
</Box>
Expand Down
Loading

0 comments on commit 4032512

Please sign in to comment.