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

Ft/codeforafrica get in touch #587

Merged
merged 11 commits into from
Sep 20, 2023
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions apps/codeforafrica/src/components/GetInTouch/GetInTouch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import TwoToneBackground from "@/codeforafrica/components/TwoToneBackground";

const GetInTouch = React.forwardRef(function GetInTouch(props, ref) {
const {
action: { href, content },
action: { href, label },
subtitle,
title,
sx,
Expand Down Expand Up @@ -59,7 +59,7 @@ const GetInTouch = React.forwardRef(function GetInTouch(props, ref) {
},
}}
>
{content}
{label}
</Button>
</Stack>
</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ exports[`<GetInTouch /> renders unchanged 1`] = `
viewbox="0 0 24 24"
/>
</span>
Get in touch
</a>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions apps/codeforafrica/src/pages/[...slugs].page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SWRConfig } from "swr";

import CustomPageHeader from "@/codeforafrica/components/CustomPageHeader";
import FeaturedProjects from "@/codeforafrica/components/FeaturedProjects";
import GetInTouch from "@/codeforafrica/components/GetInTouch";
import GetInvolved from "@/codeforafrica/components/GetInvolved";
import Hero from "@/codeforafrica/components/Hero";
import MeetOurTeam from "@/codeforafrica/components/MeetOurTeam";
Expand All @@ -14,6 +15,7 @@ import { getPageServerSideProps } from "@/codeforafrica/lib/data";

const componentsBySlugs = {
hero: Hero,
"get-in-touch": GetInTouch,
"page-header": PageHeader,
"custom-page-header": CustomPageHeader,
"meet-our-team": MeetOurTeam,
Expand Down
24 changes: 24 additions & 0 deletions apps/codeforafrica/src/payload/blocks/GetInTouch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import linkGroup from "../fields/links/linkGroup";

const GetInTouch = {
slug: "get-in-touch",
imageURL: "/images/cms/blocks/get_in_touch.jpg",
imageAltText: "Display Get In Touch Call to Action",
fields: [
{
name: "title",
label: "Title",
required: true,
type: "text",
},
{
name: "subtitle",
label: "Subtitle",
required: true,
type: "text",
},
linkGroup({ overrides: { name: "action", label: "Action" } }),
],
};

export default GetInTouch;
2 changes: 2 additions & 0 deletions apps/codeforafrica/src/payload/collections/Pages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import CustomPageHeader from "../blocks/CustomPageHeader";
import Error from "../blocks/Error";
import GetInTouch from "../blocks/GetInTouch";
import Hero from "../blocks/Hero";
import OurImpact from "../blocks/OurImpact";
import OurPartners from "../blocks/OurPartners";
Expand Down Expand Up @@ -40,6 +41,7 @@ const Pages = {
// PageHeader
blocks: [
Error,
GetInTouch,
Hero,
OurImpact,
PageHeader,
Expand Down
24 changes: 24 additions & 0 deletions apps/codeforafrica/src/payload/fields/links/linkGroup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { deepmerge } from "@mui/utils";

import link from "./link";

/**
* group field consisting of a link field.
*/
function linkGroup({ linkConfig, overrides = {} } = {}) {
const generatedLinkGroup = {
name: "link",
label: {
en: "Link",
fr: "Lien",
pt: "Link",
},
type: "group",
required: true,
fields: [link(linkConfig)],
};

return deepmerge(generatedLinkGroup, overrides);
}

export default linkGroup;