Skip to content

Commit

Permalink
Merge pull request #945 from CodeForAfrica/ft/climatemapped-navigation
Browse files Browse the repository at this point in the history
ClimateMapped Navigation
  • Loading branch information
kelvinkipruto authored Oct 18, 2024
2 parents 62f1e85 + 97e03f7 commit 150eeb8
Show file tree
Hide file tree
Showing 27 changed files with 424 additions and 724 deletions.
3 changes: 2 additions & 1 deletion apps/climatemappedafrica/payload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -65,7 +66,7 @@ export default buildConfig({
// Settings
Users,
] as CollectionConfig[],
globals: [Site] as GlobalConfig[],
globals: [HURUMap, Site] as GlobalConfig[],
...(locales?.length
? {
localization: {
Expand Down
1 change: 1 addition & 0 deletions apps/climatemappedafrica/src/assets/icons/search-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/climatemappedafrica/src/assets/menu_close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/climatemappedafrica/src/assets/menu_open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 21 additions & 6 deletions apps/climatemappedafrica/src/components/DropdownSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -66,7 +66,7 @@ function DropdownSearch({
label = "Search for a location",
locations,
onClick,
icon: iconProp = SearchIcon,
icon: IconProp = SearchIcon,
placeholder,
variant,
...props
Expand Down Expand Up @@ -112,16 +112,31 @@ 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 = (
<IconButton
color="primary"
onClick={handleClickSearch}
size="small"
className={classes.button}
>
<Image src={icon} width={48} height={48} alt="search" />
<SvgIcon
component={iconComponent}
viewBox="0 0 48 48"
sx={{
width: 48,
height: 48,
...iconBorder,
}}
/>
</IconButton>
);

Expand Down Expand Up @@ -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,
Expand Down
74 changes: 55 additions & 19 deletions apps/climatemappedafrica/src/components/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,73 @@
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 (
<div className={classes.root}>
<Section
classes={{
root: classes.section,
}}
>
<Box
sx={(theme) => ({
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)}`,
},
})}
>
<Section>
<Grid container direction="row" justifyContent="space-between">
<Grid item xs={12} container>
{logoProps && (
<LogoButton
<NextImageButton
{...logoProps}
component="a"
classes={{
root: classes.logoButton,
}}
width={220}
height={120}
priority
sx={(theme) => ({
margin: "0 auto",
padding: 0,
[theme.breakpoints.up("lg")]: {
margin: 0,
},
})}
/>
)}
</Grid>
<Grid item xs={12} lg={6}>
{description && (
<RichText
variant="body1"
className={classes.description}
sx={(theme) => ({
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: {
Expand All @@ -58,9 +91,12 @@ function Footer(props) {
<Grid item xs={12} lg={4}>
<Grid
container
classes={{
root: classes.allLinks,
}}
sx={(theme) => ({
margin: "0 auto",
flexDirection: "row",
justifyContent: "center",
marginTop: theme.typography.pxToRem(44.19),
})}
>
<Grid item xs={12} lg={6}>
{links && (
Expand Down Expand Up @@ -95,7 +131,7 @@ function Footer(props) {
</Grid>
</Grid>
</Section>
</div>
</Box>
);
}

Expand Down
71 changes: 0 additions & 71 deletions apps/climatemappedafrica/src/components/Footer/useStyles.js
Original file line number Diff line number Diff line change
@@ -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 `,
Expand Down Expand Up @@ -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",
Expand Down
30 changes: 26 additions & 4 deletions apps/climatemappedafrica/src/components/Menu/index.js
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down Expand Up @@ -57,6 +57,7 @@ const useStyles = makeStyles(({ typography, breakpoints, palette }) => ({
[breakpoints.up("lg")]: {
fontSize: typography.pxToRem(16),
},
textTransform: "uppercase",
},
menu: {
margin: 0,
Expand Down Expand Up @@ -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,
},
})}
>
<Typography variant="body1" className={classes.label}>
{item.label}
Expand All @@ -137,7 +142,24 @@ function Menu({ links, children, socialLinks, ...props }) {
</Grid>
))}
{children}
<SocialMediaIcons socialLinks={socialLinks} />
<StayInTouch
links={socialLinks}
LinkProps={{
component: Link,
sx: {
color: "text.primary",
backgroundColor: "#EBEBEB",
borderRadius: 50,
width: 42,
height: 42,
display: "flex",
justifyContent: "center",
alignItems: "center",
margin: "3.2px",
},
}}
alignItems="flex-start"
/>
</Grid>
);
}
Expand Down
Loading

0 comments on commit 150eeb8

Please sign in to comment.