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
7 changes: 7 additions & 0 deletions apps/codeforafrica/src/lib/data/rest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export const api = {

export async function getPageStaticProps(context) {
const props = await getPageProps(api, context);
if (!props) {
return {
props: {
title: "Page not found",
},
};
}
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
return {
props,
};
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 @@ -13,6 +14,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
37 changes: 37 additions & 0 deletions apps/codeforafrica/src/payload/blocks/GetInTouch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import link from "../fields/links/link";

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: "Sub Title",
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
required: true,
type: "text",
},
{
name: "action",
label: "Action Button",
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
type: "group",
fields: [
{
name: "label",
label: "Label",
type: "text",
required: true,
},
link({}),
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
],
},
],
};

export default GetInTouch;
10 changes: 9 additions & 1 deletion 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 OurPartners from "../blocks/OurPartners";
import PageHeader from "../blocks/PageHeader";
Expand Down Expand Up @@ -37,7 +38,14 @@ const Pages = {
// each other e.g. while alphabecially CustomPageHeader should be with C,
// it's functiaonally equivalent with PageHeader so we keep it next to
// PageHeader
blocks: [Error, Hero, PageHeader, CustomPageHeader, OurPartners],
blocks: [
Error,
GetInTouch,
Hero,
PageHeader,
CustomPageHeader,
OurPartners,
],
admin: {
initCollapsed: true,
},
Expand Down