diff --git a/apps/climatemappedafrica/next.config.js b/apps/climatemappedafrica/next.config.js index 2c50a972d..fa6f8ae11 100644 --- a/apps/climatemappedafrica/next.config.js +++ b/apps/climatemappedafrica/next.config.js @@ -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, @@ -51,18 +54,4 @@ module.exports = { }; return config; }, - async redirects() { - return [ - { - source: "/", - destination: "/explore/af", - permanent: true, - }, - { - source: "/explore", - destination: "/explore/af", - permanent: true, - }, - ]; - }, }; diff --git a/apps/climatemappedafrica/package.json b/apps/climatemappedafrica/package.json index e5a2e3fd2..460c2aa51 100644 --- a/apps/climatemappedafrica/package.json +++ b/apps/climatemappedafrica/package.json @@ -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:*", diff --git a/apps/climatemappedafrica/payload.config.ts b/apps/climatemappedafrica/payload.config.ts index be284f509..91c734b5a 100644 --- a/apps/climatemappedafrica/payload.config.ts +++ b/apps/climatemappedafrica/payload.config.ts @@ -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); @@ -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: { diff --git a/apps/climatemappedafrica/src/components/Footer/index.js b/apps/climatemappedafrica/src/components/Footer/index.js new file mode 100644 index 000000000..eff78692f --- /dev/null +++ b/apps/climatemappedafrica/src/components/Footer/index.js @@ -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 ( +
+
+ + + {logoProps && ( + + )} + + + {description && ( + + )} + + + + + + {links && ( + + )} + + + + + + + +
+
+ ); +} + +export default Footer; diff --git a/apps/climatemappedafrica/src/components/Footer/index.stories.js b/apps/climatemappedafrica/src/components/Footer/index.stories.js new file mode 100644 index 000000000..9c46cbae2 --- /dev/null +++ b/apps/climatemappedafrica/src/components/Footer/index.stories.js @@ -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