-
+
+
({
+ padding: 0,
+ width: theme.typography.pxToRem(254),
+ })}
>
@@ -198,9 +196,27 @@ function MobileNavigation({ logo, menus, socialLinks, ...props }) {
edge="start"
size="medium"
onClick={handleClickOpen}
- className={classes.menuButton}
+ sx={(theme) => ({
+ 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),
+ },
+ })}
>
-
+
From 53bdac181ee0cbe520ded50f7ceb41dc0bfa7e8c Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Wed, 16 Oct 2024 17:33:45 +0300
Subject: [PATCH 15/26] use custom NextImageButton
---
.../Navigation/DesktopNavigation/index.js | 14 +++++----
.../Navigation/ExploreNavigation/index.js | 14 +++++----
.../Navigation/MobileNavigation/index.js | 31 ++++++++-----------
.../src/components/NextImageButton/index.js | 23 ++++++++++++++
.../commons-ui-next/src/ImageButton/index.js | 4 +++
packages/commons-ui-next/src/index.js | 1 +
6 files changed, 57 insertions(+), 30 deletions(-)
create mode 100644 apps/climatemappedafrica/src/components/NextImageButton/index.js
create mode 100644 packages/commons-ui-next/src/ImageButton/index.js
diff --git a/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js
index 5a43f9cf0..478b0ea60 100644
--- a/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/DesktopNavigation/index.js
@@ -1,11 +1,9 @@
-import LogoButton from "@commons-ui/core/LogoButton";
import { Grid } from "@mui/material";
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";
function DesktopNavigation({ logo, menus, socialLinks }) {
@@ -14,9 +12,13 @@ function DesktopNavigation({ logo, menus, socialLinks }) {
-
-
-
+
({
@@ -55,9 +53,13 @@ function ExploreNavigation({ logo, variant }) {
-
-
-
+
({
@@ -179,16 +177,13 @@ function MobileNavigation({ logo, menus, socialLinks, ...props }) {
- ({
- padding: 0,
- width: theme.typography.pxToRem(254),
- })}
- >
-
-
+ {...logo}
+ width={180}
+ height={80}
+ priority
+ />
-
-
-
+ {...logo}
+ width={180}
+ height={80}
+ priority
+ />
+
+
+ );
+}
+
+export default NextImageButton;
diff --git a/packages/commons-ui-next/src/ImageButton/index.js b/packages/commons-ui-next/src/ImageButton/index.js
new file mode 100644
index 000000000..9dccd494f
--- /dev/null
+++ b/packages/commons-ui-next/src/ImageButton/index.js
@@ -0,0 +1,4 @@
+// This is a temporary solution for packages still using the old commons-ui-core package.
+import { ImageButton } from "@commons-ui/core";
+
+export default ImageButton;
diff --git a/packages/commons-ui-next/src/index.js b/packages/commons-ui-next/src/index.js
index c37bd3e41..ed7c26a81 100644
--- a/packages/commons-ui-next/src/index.js
+++ b/packages/commons-ui-next/src/index.js
@@ -5,3 +5,4 @@ export * from "./Link";
export { default as RichTypography } from "./RichTypography";
export { default as StayInTouch } from "./StayInTouch";
+export { default as ImageButton } from "./ImageButton";
From 43187f02d29fe3463e717aa0f4ff40bab9ea5517 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Wed, 16 Oct 2024 17:43:54 +0300
Subject: [PATCH 16/26] fix icon buttons
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../components/Navigation/MobileNavigation/index.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
index 610cf8969..bf3ac969e 100644
--- a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
@@ -206,10 +206,10 @@ function MobileNavigation({ logo, menus, socialLinks, ...props }) {
>
@@ -255,8 +255,8 @@ function MobileNavigation({ logo, menus, socialLinks, ...props }) {
component={MenuCloseIcon}
viewBox="0 0 48 48"
sx={{
- width: 48,
- height: 48,
+ width: 32,
+ height: 32,
}}
/>
From 596161fe12096e0d58622c3f046e7adb2ce8d10b Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Wed, 16 Oct 2024 17:51:35 +0300
Subject: [PATCH 17/26] Use different drawer logo
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../components/Navigation/MobileNavigation/index.js | 4 ++--
apps/climatemappedafrica/src/lib/data/common/index.js | 2 ++
.../src/payload/globals/site/GeneralTab.js | 10 ++++++++++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
index bf3ac969e..d5aca1090 100644
--- a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
@@ -151,7 +151,7 @@ const Transition = React.forwardRef(function Transition(props, ref) {
return ;
});
-function MobileNavigation({ logo, menus, socialLinks, ...props }) {
+function MobileNavigation({ drawerLogo, logo, menus, socialLinks, ...props }) {
const classes = useStyles(props);
const [open, setOpen] = useState(false);
const router = useRouter();
@@ -237,7 +237,7 @@ function MobileNavigation({ logo, menus, socialLinks, ...props }) {
connect.includes(link.platform));
return {
logo: imageFromMedia(title, primaryLogo.url),
+ drawerLogo: imageFromMedia(title, drawerLogo.url),
menus,
socialLinks,
};
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",
From 19a04355e52abffa6f2645b191bbbce7b982de83 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Wed, 16 Oct 2024 18:05:57 +0300
Subject: [PATCH 18/26] Remove unused component
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../Navigation/MobileNavigation/index.js | 1 +
.../src/components/SocialMediaIcons/index.js | 88 -------------------
.../SocialMediaIcons/index.stories.js | 26 ------
3 files changed, 1 insertion(+), 114 deletions(-)
delete mode 100644 apps/climatemappedafrica/src/components/SocialMediaIcons/index.js
delete mode 100644 apps/climatemappedafrica/src/components/SocialMediaIcons/index.stories.js
diff --git a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
index d5aca1090..1628a8dc3 100644
--- a/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
+++ b/apps/climatemappedafrica/src/components/Navigation/MobileNavigation/index.js
@@ -296,6 +296,7 @@ function MobileNavigation({ drawerLogo, logo, menus, socialLinks, ...props }) {
}
MobileNavigation.propTypes = {
+ drawerLogo: PropTypes.shape({}),
logo: PropTypes.shape({}),
menus: PropTypes.arrayOf(PropTypes.shape({})),
socialLinks: PropTypes.arrayOf(PropTypes.shape({})),
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,
-};
From 8e355f36e6c6b6ecdd45b3fc15b8f231225445af Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 17 Oct 2024 15:06:13 +0300
Subject: [PATCH 19/26] Remove Base Page
---
.../src/components/Page/Base.js | 64 -------------------
.../src/components/Page/index.js | 18 ------
.../src/pages/[[...slug]].js | 49 ++++++++++++--
3 files changed, 43 insertions(+), 88 deletions(-)
delete mode 100644 apps/climatemappedafrica/src/components/Page/Base.js
delete mode 100644 apps/climatemappedafrica/src/components/Page/index.js
diff --git a/apps/climatemappedafrica/src/components/Page/Base.js b/apps/climatemappedafrica/src/components/Page/Base.js
deleted file mode 100644
index d297d804b..000000000
--- a/apps/climatemappedafrica/src/components/Page/Base.js
+++ /dev/null
@@ -1,64 +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";
-
-/**
- * Base page that can be used to build all other pages.
- */
-function BasePage({ children, menus, variant, footer: footerProps }) {
- const seo = {};
- const theme = useTheme();
-
- const isDesktop = useMediaQuery(theme.breakpoints.up("lg"));
-
- 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/pages/[[...slug]].js b/apps/climatemappedafrica/src/pages/[[...slug]].js
index 566308264..893b43ad8 100644
--- a/apps/climatemappedafrica/src/pages/[[...slug]].js
+++ b/apps/climatemappedafrica/src/pages/[[...slug]].js
@@ -1,8 +1,12 @@
+import { useMediaQuery } from "@mui/material";
+import { useTheme } from "@mui/material/styles";
+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 Summary from "@/climatemappedafrica/components/Summary";
import { getPageServerSideProps } from "@/climatemappedafrica/lib/data";
@@ -11,9 +15,35 @@ const componentsBySlugs = {
team: AboutTeam,
};
-function Index({ blocks, fallback, ...props }) {
- if (!blocks?.length) {
- return null;
+function Index({
+ blocks,
+ menus,
+ footer: footerProps,
+ seo = {},
+ variant,
+ fallback,
+}) {
+ const theme = useTheme();
+
+ const isDesktop = useMediaQuery(theme.breakpoints.up("lg"));
+
+ 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;
+ }
}
let PageConfig = React.Fragment;
@@ -23,7 +53,13 @@ function Index({ blocks, fallback, ...props }) {
pageConfigProps = { value: { fallback } };
}
return (
-
+ <>
+
+
{blocks.map((block) => {
const Component = componentsBySlugs[block.slug];
@@ -33,7 +69,8 @@ function Index({ blocks, fallback, ...props }) {
return ;
})}
-
+ {!(variant === "explore" && isDesktop) && }
+ >
);
}
From 6a1a7488b96c15b253e3e7aedb8a28cce36a3400 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 17 Oct 2024 15:08:44 +0300
Subject: [PATCH 20/26] rename getMenus to getNavBar
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
apps/climatemappedafrica/src/lib/data/common/index.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/climatemappedafrica/src/lib/data/common/index.js b/apps/climatemappedafrica/src/lib/data/common/index.js
index 5255c6b41..d50c98804 100644
--- a/apps/climatemappedafrica/src/lib/data/common/index.js
+++ b/apps/climatemappedafrica/src/lib/data/common/index.js
@@ -33,7 +33,7 @@ function getFooter(siteSettings) {
};
}
-function getMenus(siteSettings) {
+function getNavBar(siteSettings) {
const {
connect: { links = [] },
primaryNavigation: { menus = [], connect = [] },
@@ -76,7 +76,7 @@ export async function getPageProps(api, context) {
const siteSettings = await api.findGlobal("settings-site");
const footer = getFooter(siteSettings);
- const menus = getMenus(siteSettings);
+ const menus = getNavBar(siteSettings);
return {
blocks,
From 80199d5392fec8ce39bcc6a183a87d3a815d6ec3 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Thu, 17 Oct 2024 15:35:10 +0300
Subject: [PATCH 21/26] Remove variant from page
---
.../src/components/Footer/index.js | 168 ++++++++++--------
.../src/components/Navigation/index.js | 2 +-
.../src/lib/data/common/index.js | 12 +-
.../src/pages/[[...slug]].js | 19 +-
4 files changed, 102 insertions(+), 99 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/Footer/index.js b/apps/climatemappedafrica/src/components/Footer/index.js
index eff78692f..7da3df444 100644
--- a/apps/climatemappedafrica/src/components/Footer/index.js
+++ b/apps/climatemappedafrica/src/components/Footer/index.js
@@ -1,7 +1,8 @@
import { QuickLinks, LogoButton, Copyright } from "@commons-ui/core";
import { Link, StayInTouch } from "@commons-ui/next";
import { RichText } from "@commons-ui/payload";
-import { Grid } from "@mui/material";
+import { Grid, useMediaQuery } from "@mui/material";
+import { useTheme } from "@mui/material/styles";
import React from "react";
import useStyles from "./useStyles";
@@ -9,93 +10,106 @@ import useStyles from "./useStyles";
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);
+
+ const theme = useTheme();
+
+ const isDesktop = useMediaQuery(theme.breakpoints.up("lg"));
return (
-
-
-
-
- {logoProps && (
-
+
+
+
+ {logoProps && (
+
+ )}
+
+
+ {description && (
+
+ )}
+
- )}
-
-
- {description && (
-
+
+
- )}
-
-
-
-
-
- {links && (
-
+
+ {links && (
+
+ )}
+
+
+
- )}
-
-
-
+
-
-
-
+
+
+ )
);
}
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/lib/data/common/index.js b/apps/climatemappedafrica/src/lib/data/common/index.js
index d50c98804..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,10 +30,11 @@ function getFooter(siteSettings) {
},
newsletter,
title,
+ variant,
};
}
-function getNavBar(siteSettings) {
+function getNavBar(siteSettings, variant) {
const {
connect: { links = [] },
primaryNavigation: { menus = [], connect = [] },
@@ -48,6 +49,7 @@ function getNavBar(siteSettings) {
drawerLogo: imageFromMedia(title, drawerLogo.url),
menus,
socialLinks,
+ variant,
};
}
@@ -73,15 +75,15 @@ export async function getPageProps(api, context) {
} = 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 menus = getNavBar(siteSettings);
+ const footer = getFooter(siteSettings, variant);
+ const menus = getNavBar(siteSettings, variant);
return {
blocks,
footer,
menus,
- variant: page.slug === explorePage.slug ? "explore" : "default",
};
}
diff --git a/apps/climatemappedafrica/src/pages/[[...slug]].js b/apps/climatemappedafrica/src/pages/[[...slug]].js
index 893b43ad8..43327abb1 100644
--- a/apps/climatemappedafrica/src/pages/[[...slug]].js
+++ b/apps/climatemappedafrica/src/pages/[[...slug]].js
@@ -1,5 +1,3 @@
-import { useMediaQuery } from "@mui/material";
-import { useTheme } from "@mui/material/styles";
import { NextSeo } from "next-seo";
import React from "react";
import { SWRConfig } from "swr";
@@ -15,18 +13,7 @@ const componentsBySlugs = {
team: AboutTeam,
};
-function Index({
- blocks,
- menus,
- footer: footerProps,
- seo = {},
- variant,
- fallback,
-}) {
- const theme = useTheme();
-
- const isDesktop = useMediaQuery(theme.breakpoints.up("lg"));
-
+function Index({ blocks, menus, footer: footerProps, seo = {}, fallback }) {
const pageSeo = {};
pageSeo.title = seo?.title || undefined;
pageSeo.description = seo?.metaDesc || undefined;
@@ -54,7 +41,7 @@ function Index({
}
return (
<>
-
+
;
})}
- {!(variant === "explore" && isDesktop) && }
+
>
);
}
From c483d4991812cea40a86d8d6be8f46fc905df9c1 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Fri, 18 Oct 2024 13:29:38 +0300
Subject: [PATCH 22/26] Update
apps/climatemappedafrica/src/components/DropdownSearch/index.js
Co-authored-by: Clemence Kyara
---
.../src/components/DropdownSearch/index.js | 30 ++++++-------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/index.js b/apps/climatemappedafrica/src/components/DropdownSearch/index.js
index 575b36322..bccfa2356 100644
--- a/apps/climatemappedafrica/src/components/DropdownSearch/index.js
+++ b/apps/climatemappedafrica/src/components/DropdownSearch/index.js
@@ -119,27 +119,15 @@ function DropdownSearch({
size="small"
className={classes.button}
>
- {variant === "explore" ? (
-
- ) : (
-
- )}
+
);
From 7d644f81711484f1dd2ed108120a996dd4aa13bf Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Fri, 18 Oct 2024 13:10:43 +0300
Subject: [PATCH 23/26] Fix footer display
---
.../src/components/Footer/index.js | 172 +++++++++---------
1 file changed, 90 insertions(+), 82 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/Footer/index.js b/apps/climatemappedafrica/src/components/Footer/index.js
index 7da3df444..11e564b13 100644
--- a/apps/climatemappedafrica/src/components/Footer/index.js
+++ b/apps/climatemappedafrica/src/components/Footer/index.js
@@ -1,8 +1,7 @@
import { QuickLinks, LogoButton, Copyright } from "@commons-ui/core";
import { Link, StayInTouch } from "@commons-ui/next";
import { RichText } from "@commons-ui/payload";
-import { Grid, useMediaQuery } from "@mui/material";
-import { useTheme } from "@mui/material/styles";
+import { Box, Grid } from "@mui/material";
import React from "react";
import useStyles from "./useStyles";
@@ -20,96 +19,105 @@ function Footer(props) {
} = props;
const classes = useStyles(props);
- const theme = useTheme();
-
- const isDesktop = useMediaQuery(theme.breakpoints.up("lg"));
return (
- !(variant === "explore" && isDesktop) && (
-
-
-
-
- {logoProps && (
-
- )}
-
-
- {description && (
-
- )}
- ({
+ 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 && (
+
-
-
-
+
+ {description && (
+
-
- {links && (
-
- )}
-
-
-
+ )}
+
+
+
+
+
+ {links && (
+
-
+ )}
+
+
+
-
-
- )
+
+
+
);
}
From 48de42b59916071b8dfd6272db856f801534b54f Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Fri, 18 Oct 2024 13:25:41 +0300
Subject: [PATCH 24/26] Remove usestyles
---
.../src/components/Footer/index.js | 44 ++++++++----
.../src/components/Footer/useStyles.js | 71 -------------------
2 files changed, 29 insertions(+), 86 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/Footer/index.js b/apps/climatemappedafrica/src/components/Footer/index.js
index 11e564b13..57e721b1f 100644
--- a/apps/climatemappedafrica/src/components/Footer/index.js
+++ b/apps/climatemappedafrica/src/components/Footer/index.js
@@ -1,4 +1,4 @@
-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 { Box, Grid } from "@mui/material";
@@ -6,6 +6,7 @@ import React from "react";
import useStyles from "./useStyles";
+import NextImageButton from "@/climatemappedafrica/components/NextImageButton";
import Section from "@/climatemappedafrica/components/Section";
function Footer(props) {
@@ -35,20 +36,22 @@ function Footer(props) {
},
})}
>
-
+
{logoProps && (
- ({
+ margin: "0 auto",
+ padding: 0,
+ [theme.breakpoints.up("lg")]: {
+ margin: 0,
+ },
+ })}
/>
)}
@@ -56,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: {
@@ -80,9 +91,12 @@ function Footer(props) {
({
+ margin: "0 auto",
+ flexDirection: "row",
+ justifyContent: "center",
+ marginTop: theme.typography.pxToRem(44.19),
+ })}
>
{links && (
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",
From 79baf196e576b8883cbe8cba8ee0abdebe16e336 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Fri, 18 Oct 2024 13:30:20 +0300
Subject: [PATCH 25/26] Fix null SEO
---
apps/climatemappedafrica/src/pages/[[...slug]].js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/apps/climatemappedafrica/src/pages/[[...slug]].js b/apps/climatemappedafrica/src/pages/[[...slug]].js
index 83c3f39d8..d5b79793e 100644
--- a/apps/climatemappedafrica/src/pages/[[...slug]].js
+++ b/apps/climatemappedafrica/src/pages/[[...slug]].js
@@ -17,16 +17,16 @@ const componentsBySlugs = {
function Index({ blocks, menus, footer: footerProps, seo = {}, fallback }) {
const pageSeo = {};
- pageSeo.title = seo?.title || undefined;
- pageSeo.description = seo?.metaDesc || undefined;
- pageSeo.canonical = seo?.canonical || undefined;
+ 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 || undefined,
+ alt: seo.title || null,
},
];
}
From 97e03f73097fb62c309427c5e8446d1bf3c4ff7a Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Fri, 18 Oct 2024 13:34:46 +0300
Subject: [PATCH 26/26] Reduce duplicates
---
.../src/components/DropdownSearch/index.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/index.js b/apps/climatemappedafrica/src/components/DropdownSearch/index.js
index bccfa2356..dfb33c3f3 100644
--- a/apps/climatemappedafrica/src/components/DropdownSearch/index.js
+++ b/apps/climatemappedafrica/src/components/DropdownSearch/index.js
@@ -112,6 +112,15 @@ function DropdownSearch({
}
};
+ let iconComponent = SearchIcon;
+ let iconBorder;
+ if (variant === "explore") {
+ iconComponent = IconProp;
+ iconBorder = {
+ borderRadius: "50%",
+ border: "2px solid #fff",
+ };
+ }
const searchIconButton = (