Skip to content

Commit

Permalink
Merge pull request #940 from CodeForAfrica/ft/climatemapped-footer
Browse files Browse the repository at this point in the history
Ft/climatemapped Footer
  • Loading branch information
kelvinkipruto authored Oct 11, 2024
2 parents 6507997 + c30876c commit fd6fe73
Show file tree
Hide file tree
Showing 43 changed files with 1,678 additions and 29 deletions.
37 changes: 13 additions & 24 deletions apps/climatemappedafrica/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ module.exports = {
"@hurumap/next",
],
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
use: [
"@svgr/webpack",
{
loader: "svg-url-loader",
options: {},
},
],
});
config.module.rules.push(
{
test: /\.svg$/i,
type: "asset",
resourceQuery: /url/, // *.svg?url
},
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
resourceQuery: { not: [/url/] }, // exclude react component if *.svg?url
use: ["@svgr/webpack"],
},
);
// eslint-disable-next-line no-param-reassign
config.resolve.fallback = {
...config.resolve.fallback,
Expand All @@ -51,18 +54,4 @@ module.exports = {
};
return config;
},
async redirects() {
return [
{
source: "/",
destination: "/explore/af",
permanent: true,
},
{
source: "/explore",
destination: "/explore/af",
permanent: true,
},
];
},
};
1 change: 1 addition & 0 deletions apps/climatemappedafrica/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@apollo/client": "catalog:",
"@commons-ui/core": "catalog:",
"@commons-ui/next": "workspace:*",
"@commons-ui/payload": "workspace:*",
"@emotion/react": "catalog:",
"@emotion/styled": "catalog:",
"@hurumap/core": "workspace:*",
Expand Down
4 changes: 3 additions & 1 deletion apps/climatemappedafrica/payload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Media from "./src/payload/collections/Media";
import Pages from "./src/payload/collections/Pages";
import Users from "./src/payload/collections/Users";

import Site from "./src/payload/globals/Site";

const projectDir = process.cwd();
loadEnvConfig(projectDir);

Expand Down Expand Up @@ -52,7 +54,7 @@ export default buildConfig({
migrationDir: process.env.MIGRATIONS_DIR,
}),
collections: [Media, Pages, Users] as CollectionConfig[],
globals: [] as GlobalConfig[],
globals: [Site] as GlobalConfig[],
...(locales?.length
? {
localization: {
Expand Down
102 changes: 102 additions & 0 deletions apps/climatemappedafrica/src/components/Footer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
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 React from "react";

import useStyles from "./useStyles";

import Section from "@/climatemappedafrica/components/Section";

function Footer(props) {
const { title, connect, description, logo: logoProps, links } = props;
const classes = useStyles(props);
return (
<div className={classes.root}>
<Section
classes={{
root: classes.section,
}}
>
<Grid container direction="row" justifyContent="space-between">
<Grid item xs={12} container>
{logoProps && (
<LogoButton
{...logoProps}
component="a"
classes={{
root: classes.logoButton,
}}
/>
)}
</Grid>
<Grid item xs={12} lg={6}>
{description && (
<RichText
variant="body1"
className={classes.description}
elements={description}
typographyProps={{
LinkProps: {
color: "text.secondary",
sx: {
textDecorationColor: "text.secondary",
textDecoration: "underline",
},
},
}}
/>
)}
<Copyright
copyright={${new Date().getFullYear()} ${title}`}
classes={{
root: classes.copyright,
text: classes.copyrightText,
}}
/>
</Grid>
<Grid item xs={12} lg={4}>
<Grid
container
classes={{
root: classes.allLinks,
}}
>
<Grid item xs={12} lg={6}>
{links && (
<QuickLinks
linkComponent={Link}
{...links}
classes={{
root: classes.quickLinkRoot,
list: classes.quickList,
link: classes.quickLink,
title: classes.quickLinksTitle,
}}
/>
)}
</Grid>
<Grid item xs={12} lg={6}>
<StayInTouch
{...connect}
LinkProps={{
component: Link,
sx: { color: "text.secondary" },
}}
TitleProps={{
variant: "footerCap",
sx: { color: "text.secondary" },
}}
sx={{ gap: 2 }}
direction="column"
/>
</Grid>
</Grid>
</Grid>
</Grid>
</Section>
</div>
);
}

export default Footer;
160 changes: 160 additions & 0 deletions apps/climatemappedafrica/src/components/Footer/index.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/* eslint-disable import/no-anonymous-default-export */
import React from "react";

import Footer from ".";

export default {
title: "ClimateMappedAfrica/Sections/Footer",
argTypes: {
title: {
control: {
type: "text",
},
},
socialMedia: {
control: {
type: "object",
},
},
quickLinks: {
control: {
type: "array",
},
},
description: {
control: {
type: "text",
},
},
aboutVariant: {
control: {
type: "select",
},
options: ["subtitle1", "body1"],
},
copyrightProps: {
control: {
type: "object",
},
},
logoProps: {
control: {
type: "object",
},
},
},
};

function Template({ ...args }) {
return <Footer {...args} />;
}

export const Default = Template.bind({});

Default.parameters = {
nextjs: {
router: {
pathname: "/?path=/story/sections-footer--default",
},
},
};

Default.args = {
connect: {
title: "Stay in Touch",
links: [
{
platform: "Facebook",
url: "https://www.google.com",
id: "67050ad20d400b5e511b2871",
},
{
platform: "Twitter",
url: "https://Twitter.com",
id: "6706844a6339b76017e6c782",
},
],
},
description: [
{
children: [
{
text: "This site is an ",
children: null,
},
{
newTab: false,
type: "link",
url: "https://github.com/CodeForAfrica/ui/tree/main/apps/roboshield",
children: [
{
text: "open source code",
children: null,
},
],
href: "https://github.com/CodeForAfrica/ui/tree/main/apps/roboshield",
},
{
text: " built by ",
children: null,
},
{
newTab: false,
type: "link",
url: "https://codeforafrica.org/",
children: [
{
text: "Code for Africa",
children: null,
},
],
href: "https://codeforafrica.org/",
},
{
text: ", the continent's largest network of civic technology and data journalism labs. All content is released under a ",
children: null,
},
{
newTab: false,
type: "link",
url: "https://creativecommons.org/licenses/by/4.0/",
children: [
{
text: "Creative Commons 4 Attribution",
children: null,
},
],
href: "https://creativecommons.org/licenses/by/4.0/",
},
{
text: " License. Reuse it to help empower your own community.",
children: null,
},
],
},
],
links: {
title: "Resources",
links: [
{
label: "About",
linkType: "custom",
url: "/",
href: "/",
id: "67063751048cfcc79c43a6f9",
},
{
label: "Privacy Policy",
linkType: "custom",
url: "/",
href: "/",
id: "6706375d048cfcc79c43a6fa",
},
],
},
logo: {
alt: "ClimateMappedAfrica",
src: "http://localhost:3000/media/Group-4426.svg",
},
title: "Climate Mapped Africa",
};
Loading

0 comments on commit fd6fe73

Please sign in to comment.