Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClimateMapped Navigation #945

Merged
merged 32 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
673bef7
Working Dashboard page
kelvinkipruto Oct 11, 2024
de2c831
STay in touch button
kelvinkipruto Oct 11, 2024
e4ce493
Add page variant
kelvinkipruto Oct 11, 2024
a620bd0
Remove explore page
kelvinkipruto Oct 11, 2024
94fac7f
Mobile logog
kelvinkipruto Oct 11, 2024
df60c24
Mobile Nav
kelvinkipruto Oct 11, 2024
3931460
clean proptypes
kelvinkipruto Oct 11, 2024
85e81f9
Merge branch 'main' into ft/climatemapped-navigation
kelvinkipruto Oct 14, 2024
c81889c
Fix mobile nav isues
kelvinkipruto Oct 14, 2024
1a324b0
Remove Stories
kelvinkipruto Oct 14, 2024
7ef8099
Align social links in mobile
kelvinkipruto Oct 14, 2024
14f1fe9
Fix search icon
kelvinkipruto Oct 14, 2024
05f9276
Merge branch 'main' into ft/climatemapped-navigation
kelvinkipruto Oct 14, 2024
2213aaf
Add global HURUMap config
kelvinkipruto Oct 15, 2024
d5d52f5
Remove page variant
kelvinkipruto Oct 15, 2024
bafcab8
Merge branch 'main' into ft/climatemapped-navigation
kelvinkipruto Oct 15, 2024
906278c
Use SX where possible
kelvinkipruto Oct 15, 2024
4338baf
Merge branch 'main' into ft/climatemapped-navigation
kelvinkipruto Oct 16, 2024
53bdac1
use custom NextImageButton
kelvinkipruto Oct 16, 2024
43187f0
fix icon buttons
kelvinkipruto Oct 16, 2024
596161f
Use different drawer logo
kelvinkipruto Oct 16, 2024
19a0435
Remove unused component
kelvinkipruto Oct 16, 2024
20b1679
Merge branch 'main' into ft/climatemapped-navigation
kelvinkipruto Oct 17, 2024
8e355f3
Remove Base Page
kelvinkipruto Oct 17, 2024
6a1a748
rename getMenus to getNavBar
kelvinkipruto Oct 17, 2024
80199d5
Remove variant from page
kelvinkipruto Oct 17, 2024
580754f
Merge branch 'main' into ft/climatemapped-navigation
kelvinkipruto Oct 18, 2024
c483d49
Update apps/climatemappedafrica/src/components/DropdownSearch/index.js
kelvinkipruto Oct 18, 2024
7d644f8
Fix footer display
kelvinkipruto Oct 18, 2024
48de42b
Remove usestyles
kelvinkipruto Oct 18, 2024
79baf19
Fix null SEO
kelvinkipruto Oct 18, 2024
97e03f7
Reduce duplicates
kelvinkipruto Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading