diff --git a/apps/climatemappedafrica/payload.config.ts b/apps/climatemappedafrica/payload.config.ts
index 6d65eb688..70ac036cd 100644
--- a/apps/climatemappedafrica/payload.config.ts
+++ b/apps/climatemappedafrica/payload.config.ts
@@ -16,6 +16,7 @@ import Members from "./src/payload/collections/Members";
import Pages from "./src/payload/collections/Pages";
import Users from "./src/payload/collections/Users";
+import HURUMap from "./src/payload/globals/HURUMap";
import Site from "./src/payload/globals/site";
const projectDir = process.cwd();
@@ -65,7 +66,7 @@ export default buildConfig({
// Settings
Users,
] as CollectionConfig[],
- globals: [Site] as GlobalConfig[],
+ globals: [HURUMap, Site] as GlobalConfig[],
...(locales?.length
? {
localization: {
diff --git a/apps/climatemappedafrica/src/assets/icons/search-open.svg b/apps/climatemappedafrica/src/assets/icons/search-open.svg
new file mode 100644
index 000000000..d2f039c1a
--- /dev/null
+++ b/apps/climatemappedafrica/src/assets/icons/search-open.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/apps/climatemappedafrica/src/assets/menu_close.svg b/apps/climatemappedafrica/src/assets/menu_close.svg
new file mode 100644
index 000000000..779b651b3
--- /dev/null
+++ b/apps/climatemappedafrica/src/assets/menu_close.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/apps/climatemappedafrica/src/assets/menu_open.svg b/apps/climatemappedafrica/src/assets/menu_open.svg
new file mode 100644
index 000000000..103535fbb
--- /dev/null
+++ b/apps/climatemappedafrica/src/assets/menu_open.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/index.js b/apps/climatemappedafrica/src/components/DropdownSearch/index.js
index 24b03aa1a..dfb33c3f3 100644
--- a/apps/climatemappedafrica/src/components/DropdownSearch/index.js
+++ b/apps/climatemappedafrica/src/components/DropdownSearch/index.js
@@ -4,9 +4,9 @@ import {
Typography,
List,
ListItem,
+ SvgIcon,
} from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
-import Image from "next/image";
import { useRouter } from "next/router";
import PropTypes from "prop-types";
import React, { useEffect, useState } from "react";
@@ -66,7 +66,7 @@ function DropdownSearch({
label = "Search for a location",
locations,
onClick,
- icon: iconProp = SearchIcon,
+ icon: IconProp = SearchIcon,
placeholder,
variant,
...props
@@ -112,8 +112,15 @@ function DropdownSearch({
}
};
- const icon =
- !suggestions?.length || variant === "explore" ? iconProp : SearchIcon;
+ let iconComponent = SearchIcon;
+ let iconBorder;
+ if (variant === "explore") {
+ iconComponent = IconProp;
+ iconBorder = {
+ borderRadius: "50%",
+ border: "2px solid #fff",
+ };
+ }
const searchIconButton = (
-
+
);
@@ -171,7 +186,7 @@ DropdownSearch.propTypes = {
label: PropTypes.string,
href: PropTypes.string,
onClick: PropTypes.func,
- icon: PropTypes.string,
+ icon: PropTypes.elementType,
locations: PropTypes.arrayOf(PropTypes.shape({})),
variant: PropTypes.string,
placeholder: PropTypes.string,
diff --git a/apps/climatemappedafrica/src/components/Footer/index.js b/apps/climatemappedafrica/src/components/Footer/index.js
index eff78692f..57e721b1f 100644
--- a/apps/climatemappedafrica/src/components/Footer/index.js
+++ b/apps/climatemappedafrica/src/components/Footer/index.js
@@ -1,32 +1,57 @@
-import { QuickLinks, LogoButton, Copyright } from "@commons-ui/core";
+import { QuickLinks, Copyright } from "@commons-ui/core";
import { Link, StayInTouch } from "@commons-ui/next";
import { RichText } from "@commons-ui/payload";
-import { Grid } from "@mui/material";
+import { Box, Grid } from "@mui/material";
import React from "react";
import useStyles from "./useStyles";
+import NextImageButton from "@/climatemappedafrica/components/NextImageButton";
import Section from "@/climatemappedafrica/components/Section";
function Footer(props) {
- const { title, connect, description, logo: logoProps, links } = props;
+ const {
+ title,
+ connect,
+ description,
+ logo: logoProps,
+ links,
+ variant,
+ } = props;
const classes = useStyles(props);
+
return (
-
-
+ ({
+ display: {
+ xs: "block",
+ lg: variant !== "explore" ? "block" : "none",
+ },
+ background: theme.palette.grey.dark,
+ height: "auto",
+ padding: `${theme.typography.pxToRem(80)} 0`,
+ [theme.breakpoints.up("md")]: {
+ paddingTop: `${theme.typography.pxToRem(58)}`,
+ paddingBottom: `${theme.typography.pxToRem(82)}`,
+ },
+ })}
+ >
+
{logoProps && (
- ({
+ margin: "0 auto",
+ padding: 0,
+ [theme.breakpoints.up("lg")]: {
+ margin: 0,
+ },
+ })}
/>
)}
@@ -34,7 +59,15 @@ function Footer(props) {
{description && (
({
+ color: theme.palette.text.secondary,
+ padding: `${theme.typography.pxToRem(32)} 0`,
+ fontSize: theme.typography.subtitle1.fontSize,
+ textAlign: "center",
+ [theme.breakpoints.up("lg")]: {
+ textAlign: "left",
+ },
+ })}
elements={description}
typographyProps={{
LinkProps: {
@@ -58,9 +91,12 @@ function Footer(props) {
({
+ margin: "0 auto",
+ flexDirection: "row",
+ justifyContent: "center",
+ marginTop: theme.typography.pxToRem(44.19),
+ })}
>
{links && (
@@ -95,7 +131,7 @@ function Footer(props) {
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/Footer/useStyles.js b/apps/climatemappedafrica/src/components/Footer/useStyles.js
index 603fb2cc9..3eb03a86b 100644
--- a/apps/climatemappedafrica/src/components/Footer/useStyles.js
+++ b/apps/climatemappedafrica/src/components/Footer/useStyles.js
@@ -1,68 +1,6 @@
import makeStyles from "@mui/styles/makeStyles";
const useStyles = makeStyles(({ breakpoints, palette, typography }) => ({
- root: {
- background: palette.grey.dark,
- height: "auto",
- padding: `${typography.pxToRem(80)} 0`,
- [breakpoints.up("md")]: {
- paddingTop: `${typography.pxToRem(58)}`,
- paddingBottom: `${typography.pxToRem(82)}`,
- },
- },
- section: {},
- logoButton: {
- margin: "0 auto",
- padding: 0,
- [breakpoints.up("lg")]: {
- margin: 0,
- },
- },
- allLinks: {
- margin: "0 auto",
- flexDirection: "row",
- justifyContent: "center",
- marginTop: typography.pxToRem(44.19),
- },
- stayInTouch: {
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- letterspacing: typography.pxToRem(0.7),
- [breakpoints.up("lg")]: {
- alignItems: "flex-start",
- },
- },
- stayInTouchIcon: {
- height: "auto",
- objectFit: "none",
- display: "flex",
- width: "auto",
- },
- stayInTouchText: {
- color: palette.text.secondary,
- fontSize: typography.subtitle2.fontSize,
- fontWeight: "bold",
- padding: `${typography.pxToRem(10)} ${typography.pxToRem(8)}`,
- [breakpoints.up("lg")]: {
- padding: 0,
- },
- },
- stayInTouchLink: {
- padding: 0,
- },
- stayInTouchLinks: {
- justifyContent: "center",
- marginLeft: typography.pxToRem(-14), // (48 - 20) / 2
- marginTop: typography.pxToRem(24),
- "& > a": {
- height: typography.pxToRem(48),
- width: typography.pxToRem(48),
- borderRight: "none",
- display: "flex",
- justifyContent: "center",
- },
- },
quickLinkRoot: {
textAlign: "center",
padding: `${typography.pxToRem(32)} 0 `,
@@ -93,15 +31,6 @@ const useStyles = makeStyles(({ breakpoints, palette, typography }) => ({
fontSize: typography.subtitle2.fontSize,
fontWeight: "bold",
},
- description: {
- color: palette.text.secondary,
- padding: `${typography.pxToRem(32)} 0`,
- fontSize: typography.subtitle1.fontSize,
- textAlign: "center",
- [breakpoints.up("lg")]: {
- textAlign: "left",
- },
- },
copyright: {
margin: 0,
display: "flex",
diff --git a/apps/climatemappedafrica/src/components/Menu/index.js b/apps/climatemappedafrica/src/components/Menu/index.js
index 003842c48..31ec0c843 100644
--- a/apps/climatemappedafrica/src/components/Menu/index.js
+++ b/apps/climatemappedafrica/src/components/Menu/index.js
@@ -1,10 +1,10 @@
+import { StayInTouch } from "@commons-ui/next";
import { Grid, Button, Typography } from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
import PropTypes from "prop-types";
import React from "react";
import Link from "@/climatemappedafrica/components/Link";
-import SocialMediaIcons from "@/climatemappedafrica/components/SocialMediaIcons";
const useStyles = makeStyles(({ typography, breakpoints, palette }) => ({
root: {
@@ -57,6 +57,7 @@ const useStyles = makeStyles(({ typography, breakpoints, palette }) => ({
[breakpoints.up("lg")]: {
fontSize: typography.pxToRem(16),
},
+ textTransform: "uppercase",
},
menu: {
margin: 0,
@@ -125,10 +126,14 @@ function Menu({ links, children, socialLinks, ...props }) {
root: index !== 0 ? classes.menuLinks : classes.links,
text: classes.text,
}}
- sx={{
+ sx={(theme) => ({
borderRadius: 20,
border: index !== 0 ? 0 : "3px solid",
- }}
+ color: {
+ xs: theme.palette.text.secondary,
+ lg: theme.palette.primary.main,
+ },
+ })}
>
{item.label}
@@ -137,7 +142,24 @@ function Menu({ links, children, socialLinks, ...props }) {
))}
{children}
-
+
);
}
diff --git a/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js
index b331ac243..478b0ea60 100644
--- a/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js
@@ -1,43 +1,24 @@
-import LogoButton from "@commons-ui/core/LogoButton";
import { Grid } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
import PropTypes from "prop-types";
import React from "react";
-import Image from "@/climatemappedafrica/components/Image";
-import Link from "@/climatemappedafrica/components/Link";
import Menu from "@/climatemappedafrica/components/Menu";
+import NextImageButton from "@/climatemappedafrica/components/NextImageButton";
import Section from "@/climatemappedafrica/components/Section";
-const useStyles = makeStyles(() => ({
- root: {},
- logoButton: {
- paddingLeft: 0,
- },
- section: {},
-}));
-
-function DesktopNavigation({
- logoProps,
- menuProps,
- desktopLogoProps,
- socialLinks,
- ...props
-}) {
- const classes = useStyles(props);
-
+function DesktopNavigation({ logo, menus, socialLinks }) {
return (
-
-
+
+
-
-
-
+ {...logo}
+ width={200}
+ height={100}
+ priority
+ />
-
+
@@ -57,16 +38,9 @@ function DesktopNavigation({
}
DesktopNavigation.propTypes = {
- logoProps: PropTypes.shape({}),
- menuProps: PropTypes.arrayOf(PropTypes.shape({})),
+ logo: PropTypes.shape({}),
+ menus: PropTypes.arrayOf(PropTypes.shape({})),
socialLinks: PropTypes.arrayOf(PropTypes.shape({})),
- desktopLogoProps: PropTypes.shape({
- alt: PropTypes.string,
- href: PropTypes.string,
- src: PropTypes.oneOfType([PropTypes.shape({}), PropTypes.string]),
- width: PropTypes.number,
- height: PropTypes.number,
- }),
};
export default DesktopNavigation;
diff --git a/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js
index 82420055c..f74bde844 100644
--- a/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/ExploreNavigation/index.js
@@ -1,6 +1,4 @@
-import LogoButton from "@commons-ui/core/LogoButton";
-import { Grid, Typography, useMediaQuery } from "@mui/material";
-import { useTheme } from "@mui/material/styles";
+import { Grid, Typography } from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
import { useTour } from "@reactour/tour";
import PropTypes from "prop-types";
@@ -8,26 +6,10 @@ import React from "react";
import SearchIcon from "@/climatemappedafrica/assets/icons/search-explore.svg";
import DropdownSearch from "@/climatemappedafrica/components/DropdownSearch";
-import Image from "@/climatemappedafrica/components/Image";
-import Link from "@/climatemappedafrica/components/Link";
+import NextImageButton from "@/climatemappedafrica/components/NextImageButton";
import Section from "@/climatemappedafrica/components/Section";
const useStyles = makeStyles(({ palette, typography }) => ({
- root: {},
- section: {},
- logoButton: {
- padding: 0,
- },
- help: {
- color: "#666666",
- textAlign: "center",
- backgroundColor: "#EBEBEB",
- borderRadius: typography.pxToRem(60),
- marginLeft: typography.pxToRem(20),
- width: typography.pxToRem(48),
- height: typography.pxToRem(48),
- cursor: "pointer",
- },
searchLabel: {
display: "none",
},
@@ -59,36 +41,25 @@ const useStyles = makeStyles(({ palette, typography }) => ({
},
}));
-function ExploreNavigation({
- logoProps,
- menuProps,
- onOpenHelp,
- socialLinks,
- desktopLogoProps,
- mobileLogoProps,
- ...props
-}) {
- const classes = useStyles(props);
- const theme = useTheme();
- const isDesktop = useMediaQuery(theme.breakpoints.up("lg"));
- const logoArgs = isDesktop ? desktopLogoProps : mobileLogoProps;
+function ExploreNavigation({ logo, variant }) {
+ const classes = useStyles();
const { setIsOpen } = useTour();
const openTooltip = () => {
setIsOpen(true);
};
return (
-
-
+
+
-
-
-
+ {...logo}
+ width={200}
+ height={100}
+ priority
+ />
({
+ color: "#666666",
+ textAlign: "center",
+ backgroundColor: "#EBEBEB",
+ borderRadius: theme.typography.pxToRem(60),
+ marginLeft: theme.typography.pxToRem(20),
+ width: theme.typography.pxToRem(48),
+ height: theme.typography.pxToRem(48),
+ cursor: "pointer",
+ })}
>
?
@@ -128,22 +108,8 @@ function ExploreNavigation({
}
ExploreNavigation.propTypes = {
- logoProps: PropTypes.shape({}),
- menuProps: PropTypes.arrayOf(PropTypes.shape({})),
- onOpenHelp: PropTypes.func,
- socialLinks: PropTypes.arrayOf(PropTypes.shape({})),
- desktopLogoProps: PropTypes.shape({
- alt: PropTypes.string,
- href: PropTypes.string,
- src: PropTypes.oneOfType([PropTypes.shape({}), PropTypes.string]),
- width: PropTypes.number,
- height: PropTypes.number,
- }),
- mobileLogoProps: PropTypes.shape({
- alt: PropTypes.string,
- href: PropTypes.string,
- src: PropTypes.oneOfType([PropTypes.shape({}), PropTypes.string]),
- }),
+ logo: PropTypes.shape({}),
+ variant: PropTypes.string,
};
export default ExploreNavigation;
diff --git a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
index 45892583e..1628a8dc3 100644
--- a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
@@ -1,19 +1,26 @@
-import LogoButton from "@commons-ui/core/LogoButton";
-import { Grid } from "@mui/material";
+import {
+ Grid,
+ Slide,
+ Dialog,
+ DialogActions,
+ IconButton,
+ DialogContent,
+ SvgIcon,
+} from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
-import Image from "next/image";
+import { useRouter } from "next/router";
import PropTypes from "prop-types";
-import React from "react";
+import React, { useState } from "react";
-import Link from "@/climatemappedafrica/components/Link";
+import SearchIcon from "@/climatemappedafrica/assets/icons/search-open.svg";
+import MenuCloseIcon from "@/climatemappedafrica/assets/menu_close.svg";
+import MenuOpenIcon from "@/climatemappedafrica/assets/menu_open.svg";
+import DropdownSearch from "@/climatemappedafrica/components/DropdownSearch";
+import Menu from "@/climatemappedafrica/components/Menu";
+import NextImageButton from "@/climatemappedafrica/components/NextImageButton";
import Section from "@/climatemappedafrica/components/Section";
const useStyles = makeStyles(({ breakpoints, typography, palette }) => ({
- root: {},
- logoButton: {
- padding: 0,
- },
- section: {},
dialog: {
padding: 0,
},
@@ -140,29 +147,148 @@ const useStyles = makeStyles(({ breakpoints, typography, palette }) => ({
},
}));
-function MobileNavigation({
- logoProps,
- menuProps,
- mobileLogoProps,
- drawerLogoProps,
- socialLinks,
- ...props
-}) {
+const Transition = React.forwardRef(function Transition(props, ref) {
+ return ;
+});
+
+function MobileNavigation({ drawerLogo, logo, menus, socialLinks, ...props }) {
const classes = useStyles(props);
+ const [open, setOpen] = useState(false);
+ const router = useRouter();
+
+ const handleClickOpen = (e) => {
+ e?.preventDefault();
+ setOpen(true);
+ };
+ const handleClose = (e) => {
+ e?.preventDefault();
+ setOpen(false);
+ };
+
+ const handleClickSearch = (code) => {
+ setOpen(false);
+ if (code) {
+ router.push(`explore/${code}`);
+ }
+ };
return (
-
-
+
+
-
-
+
+
+
+ ({
+ color: theme.palette.grey.dark,
+ background: "#F0F0F0",
+ borderRadius: theme.typography.pxToRem(50),
+ height: theme.typography.pxToRem(34),
+ padding: 0,
+ width: theme.typography.pxToRem(34),
+ "&:hover": {
+ background: "#F0F0F0",
+ borderRadius: theme.typography.pxToRem(50),
+ },
+ })}
>
-
-
+
+
+
+
+
+
+
+
+
+
@@ -170,15 +296,9 @@ function MobileNavigation({
}
MobileNavigation.propTypes = {
- logoProps: PropTypes.shape({}),
- menuProps: PropTypes.arrayOf(PropTypes.shape({})),
- mobileLogoProps: PropTypes.shape({
- alt: PropTypes.string,
- href: PropTypes.string,
- src: PropTypes.oneOfType([PropTypes.shape({}), PropTypes.string]),
- width: PropTypes.number,
- height: PropTypes.number,
- }),
+ drawerLogo: PropTypes.shape({}),
+ logo: PropTypes.shape({}),
+ menus: PropTypes.arrayOf(PropTypes.shape({})),
socialLinks: PropTypes.arrayOf(PropTypes.shape({})),
};
diff --git a/apps/climatemappedafrica/src/components/Navigation/index.js b/apps/climatemappedafrica/src/components/Navigation/index.js
index 866c319f1..78cd4a134 100644
--- a/apps/climatemappedafrica/src/components/Navigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/index.js
@@ -45,7 +45,7 @@ function Navigation({ variant, ...props }) {
>
{variant?.toLowerCase() === "explore" ? (
diff --git a/apps/climatemappedafrica/src/components/Navigation/index.stories.js b/apps/climatemappedafrica/src/components/Navigation/index.stories.js
deleted file mode 100644
index 18b1fa64e..000000000
--- a/apps/climatemappedafrica/src/components/Navigation/index.stories.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from "react";
-
-import Navigation from ".";
-
-import { navigationArgs } from "@/climatemappedafrica/config";
-
-export default {
- title: "Sections/Navigation",
- argTypes: {},
-};
-
-function Template({ ...args }) {
- return ;
-}
-export const Default = Template.bind({});
-
-Default.args = {
- ...navigationArgs,
-};
diff --git a/apps/climatemappedafrica/src/components/NextImageButton/index.js b/apps/climatemappedafrica/src/components/NextImageButton/index.js
new file mode 100644
index 000000000..5995199be
--- /dev/null
+++ b/apps/climatemappedafrica/src/components/NextImageButton/index.js
@@ -0,0 +1,23 @@
+import { ImageButton, Link } from "@commons-ui/next";
+import Image from "next/image";
+
+function NextImageButton(props) {
+ const { alt, height, href, priority, src, width, ...other } = props;
+
+ if (!src) {
+ return null;
+ }
+ return (
+
+
+
+ );
+}
+
+export default NextImageButton;
diff --git a/apps/climatemappedafrica/src/components/Page/Base.js b/apps/climatemappedafrica/src/components/Page/Base.js
deleted file mode 100644
index 45cf7010e..000000000
--- a/apps/climatemappedafrica/src/components/Page/Base.js
+++ /dev/null
@@ -1,78 +0,0 @@
-import { useMediaQuery } from "@mui/material";
-import { useTheme } from "@mui/material/styles";
-import { NextSeo } from "next-seo";
-import PropTypes from "prop-types";
-import React from "react";
-
-import Footer from "@/climatemappedafrica/components/Footer";
-import Navigation from "@/climatemappedafrica/components/Navigation";
-import { navigationArgs } from "@/climatemappedafrica/config";
-import getNavigationMenu from "@/climatemappedafrica/functions/menus/getNavigationMenu";
-
-/**
- * Base page that can be used to build all other pages.
- */
-function BasePage({ children, menus, variant, footer: footerProps, ...props }) {
- const seo = {};
- const navigation = getNavigationMenu(menus?.primaryMenu || []);
- const { menuProps, socialLinks } = navigation;
- const { desktopLogoProps, mobileLogoProps, drawerLogoProps } = navigationArgs;
- const theme = useTheme();
-
- const isDesktop = useMediaQuery(theme.breakpoints.up("lg"));
- const navigationProps = {
- ...props,
- ...menus,
- menuProps,
- socialLinks,
- desktopLogoProps,
- mobileLogoProps,
- drawerLogoProps,
- };
-
- const pageSeo = {};
- pageSeo.title = seo?.title || undefined;
- pageSeo.description = seo?.metaDesc || undefined;
- pageSeo.canonical = seo?.canonical || undefined;
- if (seo?.opengraphType || seo?.opengraphImage) {
- pageSeo.openGraph = {};
- if (seo.opengraphImage) {
- pageSeo.openGraph.images = [
- {
- url: seo.opengraphImage,
- alt: seo.title || undefined,
- },
- ];
- }
- if (seo.opengraphType) {
- pageSeo.openGraph.type = seo.opengraphType;
- }
- }
-
- return (
- <>
-
-
- {children}
- {!(variant === "explore" && isDesktop) && }
- >
- );
-}
-
-BasePage.propTypes = {
- children: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.node),
- PropTypes.node,
- ]),
- menus: PropTypes.shape({
- footerMenu: PropTypes.arrayOf(PropTypes.shape({})),
- primaryMenu: PropTypes.arrayOf(PropTypes.shape({})),
- }),
- variant: PropTypes.string,
-};
-
-export default BasePage;
diff --git a/apps/climatemappedafrica/src/components/Page/index.js b/apps/climatemappedafrica/src/components/Page/index.js
deleted file mode 100644
index 4d32d3f87..000000000
--- a/apps/climatemappedafrica/src/components/Page/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import PropTypes from "prop-types";
-import React from "react";
-
-import Base from "./Base";
-
-/**
- * Page component that adds error handling.
- * TODO(kilemensi): Add error handling once we have error page designs
- */
-function Page(props) {
- return ;
-}
-
-Page.propTypes = {
- errorCode: PropTypes.number,
-};
-
-export default Page;
diff --git a/apps/climatemappedafrica/src/components/SocialMediaIcons/index.js b/apps/climatemappedafrica/src/components/SocialMediaIcons/index.js
deleted file mode 100644
index 2b02c0b61..000000000
--- a/apps/climatemappedafrica/src/components/SocialMediaIcons/index.js
+++ /dev/null
@@ -1,88 +0,0 @@
-import { Grid, IconButton } from "@mui/material";
-import makeStyles from "@mui/styles/makeStyles";
-import Image from "next/image";
-import PropTypes from "prop-types";
-import React from "react";
-
-import Link from "@/climatemappedafrica/components/Link";
-
-const useStyles = makeStyles(({ breakpoints, palette, typography }) => ({
- root: {
- paddingTop: typography.pxToRem(32),
- [breakpoints.up("lg")]: {
- paddingTop: typography.pxToRem(4),
- },
- },
- image: {
- filter:
- "invert(15%) sepia(98%) saturate(6602%) hue-rotate(192deg) brightness(97%) contrast(101%);",
- [breakpoints.up("lg")]: {
- filter:
- "invert(0%) sepia(7%) saturate(27%) hue-rotate(270deg) brightness(102%) contrast(109%)",
- },
- },
- button: {
- background: palette.primary.light,
- borderRadius: 50,
- width: 48,
- height: 48,
- margin: typography.pxToRem(3.2),
- "&:hover,&:focus": {
- background: palette.primary.light,
- borderRadius: 60,
- },
- [breakpoints.up("lg")]: {
- background: "#EBEBEB",
- "&:hover,&:focus": {
- background: "#EBEBEB",
- borderRadius: 60,
- },
- },
- },
-}));
-
-function SocialMediaIcons({ socialLinks, ...props }) {
- const classes = useStyles(props);
- const viewBoxValue = "0 0 48 48";
-
- if (!socialLinks?.length) {
- return null;
- }
- return (
-
- {socialLinks.map(({ href, label, src }) => (
-
-
-
- ))}
-
- );
-}
-
-SocialMediaIcons.propTypes = {
- socialLinks: PropTypes.arrayOf(
- PropTypes.shape({
- url: PropTypes.string,
- label: PropTypes.string,
- src: PropTypes.string,
- }),
- ),
-};
-
-export default SocialMediaIcons;
diff --git a/apps/climatemappedafrica/src/components/SocialMediaIcons/index.stories.js b/apps/climatemappedafrica/src/components/SocialMediaIcons/index.stories.js
deleted file mode 100644
index ddb4348c2..000000000
--- a/apps/climatemappedafrica/src/components/SocialMediaIcons/index.stories.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from "react";
-
-import SocialMediaIcons from ".";
-
-import { navigationArgs } from "@/climatemappedafrica/config";
-
-export default {
- title: "Components/SocialMediaIcons",
- argTypes: {
- socialLinks: {
- control: {
- type: "array",
- },
- },
- },
-};
-
-function Template({ ...args }) {
- return ;
-}
-
-export const Default = Template.bind({});
-
-Default.args = {
- socialLinks: navigationArgs.socialLinks,
-};
diff --git a/apps/climatemappedafrica/src/lib/data/common/index.js b/apps/climatemappedafrica/src/lib/data/common/index.js
index b97d27209..ab0341049 100644
--- a/apps/climatemappedafrica/src/lib/data/common/index.js
+++ b/apps/climatemappedafrica/src/lib/data/common/index.js
@@ -4,7 +4,7 @@ export function imageFromMedia(alt, url) {
return { alt, src: url };
}
-function getFooter(siteSettings) {
+function getFooter(siteSettings, variant) {
const {
connect,
footerNavigation,
@@ -30,6 +30,26 @@ function getFooter(siteSettings) {
},
newsletter,
title,
+ variant,
+ };
+}
+
+function getNavBar(siteSettings, variant) {
+ const {
+ connect: { links = [] },
+ primaryNavigation: { menus = [], connect = [] },
+ primaryLogo,
+ drawerLogo,
+ title,
+ } = siteSettings;
+ const socialLinks = links?.filter((link) => connect.includes(link.platform));
+
+ return {
+ logo: imageFromMedia(title, primaryLogo.url),
+ drawerLogo: imageFromMedia(title, drawerLogo.url),
+ menus,
+ socialLinks,
+ variant,
};
}
@@ -49,13 +69,21 @@ export async function getPageProps(api, context) {
return null;
}
+ const hurumap = await api.findGlobal("settings-hurumap");
+ const {
+ page: { value: explorePage },
+ } = hurumap;
+
const blocks = await blockify(page.blocks, api, context);
+ const variant = page.slug === explorePage.slug ? "explore" : "default";
const siteSettings = await api.findGlobal("settings-site");
- const footer = getFooter(siteSettings);
+ const footer = getFooter(siteSettings, variant);
+ const menus = getNavBar(siteSettings, variant);
return {
blocks,
footer,
+ menus,
};
}
diff --git a/apps/climatemappedafrica/src/pages/[[...slug]].js b/apps/climatemappedafrica/src/pages/[[...slug]].js
index 690f52524..d5b79793e 100644
--- a/apps/climatemappedafrica/src/pages/[[...slug]].js
+++ b/apps/climatemappedafrica/src/pages/[[...slug]].js
@@ -1,8 +1,10 @@
+import { NextSeo } from "next-seo";
import React from "react";
import { SWRConfig } from "swr";
import AboutTeam from "@/climatemappedafrica/components/AboutTeam";
-import Page from "@/climatemappedafrica/components/Page";
+import Footer from "@/climatemappedafrica/components/Footer";
+import Navigation from "@/climatemappedafrica/components/Navigation";
import PageHero from "@/climatemappedafrica/components/PageHero";
import Summary from "@/climatemappedafrica/components/Summary";
import { getPageServerSideProps } from "@/climatemappedafrica/lib/data";
@@ -13,9 +15,24 @@ const componentsBySlugs = {
team: AboutTeam,
};
-function Index({ blocks, fallback, ...props }) {
- if (!blocks?.length) {
- return null;
+function Index({ blocks, menus, footer: footerProps, seo = {}, fallback }) {
+ const pageSeo = {};
+ pageSeo.title = seo?.title || null;
+ pageSeo.description = seo?.metaDesc || null;
+ pageSeo.canonical = seo?.canonical || null;
+ if (seo?.opengraphType || seo?.opengraphImage) {
+ pageSeo.openGraph = {};
+ if (seo.opengraphImage) {
+ pageSeo.openGraph.images = [
+ {
+ url: seo.opengraphImage,
+ alt: seo.title || null,
+ },
+ ];
+ }
+ if (seo.opengraphType) {
+ pageSeo.openGraph.type = seo.opengraphType;
+ }
}
let PageConfig = React.Fragment;
@@ -25,7 +42,13 @@ function Index({ blocks, fallback, ...props }) {
pageConfigProps = { value: { fallback } };
}
return (
-
+ <>
+
+
{blocks.map((block) => {
const Component = componentsBySlugs[block.blockType];
@@ -36,7 +59,8 @@ function Index({ blocks, fallback, ...props }) {
return ;
})}
-
+
+ >
);
}
diff --git a/apps/climatemappedafrica/src/pages/explore/[[...slug]].js b/apps/climatemappedafrica/src/pages/explore/[[...slug]].js
deleted file mode 100644
index 60c2fbc14..000000000
--- a/apps/climatemappedafrica/src/pages/explore/[[...slug]].js
+++ /dev/null
@@ -1,246 +0,0 @@
-import { useRouter } from "next/router";
-import PropTypes from "prop-types";
-import React from "react";
-
-import ExplorePage from "@/climatemappedafrica/components/ExplorePage";
-import Tutorial from "@/climatemappedafrica/components/HURUmap/Tutorial";
-import Page from "@/climatemappedafrica/components/Page";
-import {
- fetchProfile,
- fetchProfileGeography,
-} from "@/climatemappedafrica/lib/hurumap";
-
-export default function Explore(props) {
- const { blocks: { tutorial = {}, panel = {} } = {} } = props;
- const {
- query: { showTutorial },
- } = useRouter();
-
- return (
-
-
-
-
-
- );
-}
-
-Explore.propTypes = {
- blocks: PropTypes.shape({
- panel: PropTypes.shape({}),
- tutorial: PropTypes.shape({
- items: PropTypes.arrayOf(PropTypes.shape({})),
- }),
- }),
-};
-
-export async function getStaticPaths() {
- const { locations } = await fetchProfile();
- const paths = locations.map(({ code: locationCode }) => ({
- params: { slug: [locationCode] },
- }));
-
- // only first location to save on build time
- const [firstLocation] = paths;
-
- return {
- paths: [firstLocation],
- fallback: "blocking",
- };
-}
-
-export async function getStaticProps({ params }) {
- const props = {};
- const revalidate = true;
-
- // TODO: This info was being fetched from the Wordpress CMS, and is necessary for the ExplorePage to render correctly.
- const blocks = {
- texts: [],
- tutorial: {
- items: [
- {
- title: "SELECT LOCATION",
- description:
- "Select the County or Municipality you want to explore, by clicking on the search field and the dropdown menu. Once you have made your selection, explore the visualisations, change location or pin to compare it to a second location.",
- selector: "#location-search",
- image:
- "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-1.png",
- imageProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-1.png",
- width: 694,
- height: 572,
- type: "png",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAIAAAA7ljmRAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAMElEQVR4nGOoqW09f/7Shw8fzp07x8AuoC4qqdXf311YWMTAL6YVE5ve2tpcV18PAHqlETRE6fa/AAAAAElFTkSuQmCC",
- placeholder: "blur",
- },
- },
- {
- description:
- "Explore the map to confirm or change your selection. You can also pin your location if you want to compare two places. Once a location is confirmed, click on the “Rich Data” button (on the left hand-side) to display the data visualisations.",
- title: "EXPLORE THE MAP",
- selector: "#none",
- image:
- "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-2.png",
- imageProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-2.png",
- width: 751,
- height: 589,
- type: "png",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAIAAAA7ljmRAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAMElEQVR4nGP49u3rxEnTDxw4sn//fobCggJeYVU+YaWCvByGzMxMPmElWwfPgvw8AH1vD9GRbZHGAAAAAElFTkSuQmCC",
- placeholder: "blur",
- },
- },
- {
- title: "BROWSE THE CHARTS",
- description:
- "Continue to open the Rich Data dashboard, using the button on the left. Browse the charts by scrolling the data dashboard. You can share and download the data using the buttons on the side of each chart.",
- selector: "#rich-data",
- image:
- "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-3a.png",
- imageProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-3a.png",
- width: 670,
- height: 439,
- type: "png",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAIAAAA7ljmRAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAMklEQVR4nAEnANj/ANbW1s3NyVtbWrKyswDOztFdY38JCxe5ubcA3t7ffIKf4uPq////vgcX8ZIA2dgAAAAASUVORK5CYII=",
- placeholder: "blur",
- },
- },
- {
- title: "PIN AND COMPARE",
- description:
- "There are two ways to pin and compare a second location: 1) From the data dashboard: look for the “pin” icon and select a second location from the dropdown menu. 2) From the map: pin your selected location by clicking on the ”pin” icon, then select a second location, which will appear in a different colour.",
- selector: "#pin",
- image:
- "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-4.png",
- imageProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/04/PesaYetu-Tutorial-4.png",
- width: 675,
- height: 491,
- type: "png",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAIAAAA7ljmRAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAMklEQVR4nAEnANj/APj491lWYA8QI+zs6wC/wMHXzMmLi5uztLYAu7u7w8XF39/eu7u7x7oYwYnBuWcAAAAASUVORK5CYII=",
- placeholder: "blur",
- },
- },
- ],
- lazyblock: {
- slug: "lazyblock/tutorial",
- },
- align: "",
- anchor: "",
- blockId: "Z1npKaH",
- blockUniqueClass: "lazyblock-tutorial-Z1npKaH",
- ghostkitSpacings: "",
- ghostkitSR: "",
- },
- panel: {
- panelItems: [
- {
- value: "rich-data",
- icon: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2021/11/Group-4505.svg",
- iconProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2021/11/Group-4505.svg",
- width: 44,
- height: 44,
- type: "svg",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGElEQVR4nGNgQAP/T///f/o/jHMWiQMHACIVCyeABSwfAAAAAElFTkSuQmCC",
- placeholder: "blur",
- },
- },
- {
- value: "pin",
- icon: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/01/Path-210-1-1.svg",
- pin: true,
- iconProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/01/Path-210-1-1.svg",
- width: 44,
- height: 44,
- type: "svg",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAH0lEQVR4nGNgQAP/L/z/f/r//4P/wZzT//+fBbOQAQBvnQ3r6iVM4QAAAABJRU5ErkJggg==",
- placeholder: "blur",
- },
- },
- ],
- scrollToTopLabel: "Back To Top",
- dataNotAvailable: "— DATA NOT AVAILABLE",
- lazyblock: {
- slug: "lazyblock/panel",
- },
- align: "",
- anchor: "",
- blockId: "20amuc",
- blockUniqueClass: "lazyblock-panel-20amuc",
- ghostkitSpacings: "",
- ghostkitSR: "",
- },
- };
- const { locations, preferredChildren, mapType, choropleth } =
- await fetchProfile();
- const [originalCode] = params?.slug || [""];
- const code = originalCode.trim().toLowerCase();
-
- // /explore -> /explore/dj
- if (!code) {
- return {
- redirect: {
- destination: `/explore/af`,
- permanent: true,
- },
- };
- }
-
- // Allow for case-insensitive code or human-readable location names
- // appended to code e.g.:
- // KE => ke, 47/nairobi => 47, 47-vs-11/nairobi-vs-isiolo => 47-vs-11
- if (code !== originalCode || params?.slug?.length > 1) {
- return {
- redirect: {
- destination: `/explore/${code}`,
- permanent: true,
- },
- };
- }
-
- const locationCodes = locations.map(({ code: locationCode }) => locationCode);
- const geoCodes = code
- .split("-vs-")
- .map((c) => c.trim())
- .filter((c) => c);
- if (!geoCodes.every((gC) => locationCodes.includes(gC))) {
- return {
- notFound: true,
- };
- }
-
- const [primaryCode, secondaryCode] = geoCodes;
- const primaryProfile = await fetchProfileGeography(primaryCode);
- const profile = [primaryProfile];
- if (secondaryCode) {
- const secondaryProfile = await fetchProfileGeography(secondaryCode);
- profile.push(secondaryProfile);
- }
-
- return {
- props: {
- ...props,
- blocks,
- choropleth,
- locations,
- mapType,
- profile,
- variant: "explore",
- preferredChildren,
- },
- revalidate,
- };
-}
diff --git a/apps/climatemappedafrica/src/payload/globals/HURUMap/index.js b/apps/climatemappedafrica/src/payload/globals/HURUMap/index.js
new file mode 100644
index 000000000..6a6592f31
--- /dev/null
+++ b/apps/climatemappedafrica/src/payload/globals/HURUMap/index.js
@@ -0,0 +1,22 @@
+const HURUMap = {
+ slug: "settings-hurumap",
+ label: "HURUMap",
+ access: {
+ read: () => true,
+ },
+ admin: {
+ group: "Settings",
+ },
+ fields: [
+ {
+ name: "page",
+ label: "Explore Page",
+ type: "relationship",
+ relationTo: ["pages"],
+ maxDepth: 1,
+ required: true,
+ },
+ ],
+};
+
+export default HURUMap;
diff --git a/apps/climatemappedafrica/src/payload/globals/site/GeneralTab.js b/apps/climatemappedafrica/src/payload/globals/site/GeneralTab.js
index a1fa6fb64..68be603cd 100644
--- a/apps/climatemappedafrica/src/payload/globals/site/GeneralTab.js
+++ b/apps/climatemappedafrica/src/payload/globals/site/GeneralTab.js
@@ -35,6 +35,16 @@ const GeneralTab = {
},
},
}),
+ image({
+ overrides: {
+ name: "drawerLogo",
+ required: true,
+ localized: true,
+ admin: {
+ description: "Shown on mobile navigation drawer.",
+ },
+ },
+ }),
image({
overrides: {
name: "secondaryLogo",
diff --git a/apps/climatemappedafrica/src/payload/globals/site/NavigationTab.js b/apps/climatemappedafrica/src/payload/globals/site/NavigationTab.js
index 02da38263..2567601da 100644
--- a/apps/climatemappedafrica/src/payload/globals/site/NavigationTab.js
+++ b/apps/climatemappedafrica/src/payload/globals/site/NavigationTab.js
@@ -38,6 +38,7 @@ const NavigationTab = {
{
name: "connect",
type: "select",
+ hasMany: true,
options: socialMediaOptions,
},
],
diff --git a/packages/commons-ui-core/src/StayInTouch/StayInTouch.js b/packages/commons-ui-core/src/StayInTouch/StayInTouch.js
index 896a8446b..15cb376b0 100644
--- a/packages/commons-ui-core/src/StayInTouch/StayInTouch.js
+++ b/packages/commons-ui-core/src/StayInTouch/StayInTouch.js
@@ -15,6 +15,7 @@ const StayInTouch = React.forwardRef(function StayInTouch(
sx,
title,
direction = { xs: "column", md: "row" },
+ alignItems = { xs: "center" },
},
ref,
) {
@@ -22,12 +23,7 @@ const StayInTouch = React.forwardRef(function StayInTouch(
return null;
}
return (
-
+