diff --git a/apps/codeforafrica/src/components/SinglePartner/SinglePartner.js b/apps/codeforafrica/src/components/Partner/Partner.js similarity index 98% rename from apps/codeforafrica/src/components/SinglePartner/SinglePartner.js rename to apps/codeforafrica/src/components/Partner/Partner.js index 3ad63344b..3ba81575d 100644 --- a/apps/codeforafrica/src/components/SinglePartner/SinglePartner.js +++ b/apps/codeforafrica/src/components/Partner/Partner.js @@ -55,7 +55,7 @@ const SinglePartner = React.forwardRef(function SinglePartner( - {relatedProjects.length ? ( + {relatedProjects?.length ? ( <> renders unchanged 1`] = ` +
+
+
+
+ Lorem ipsum dolor sit amet consectetur adipiscing, elit ac primis praesent + tempor luctus libero, curae condimentum ultricies proin leo. Arcu ornare dis fermentum nisi consequat imperdiet porta viverra placerat nullam, dapibus molestie faucibus id mi lacinia orci magnis. Ridiculus aptent phasellus mus nisi porta rutrum tellus, ut venenatis feugiat massa volutpat. + Duis maecenas per erat odio quisque accumsan, donec tempus class euismod vulputate fermentum imperdiet, suspendisse blandit lacinia semper cursus. Neque tristique posuere a feugiat convallis tempor cras nunc, leo faucibus cum aptent placerat aenean lobortis, nibh iaculis ac nascetur praesent mus quisque. Nullam leo rutrum augue urna cubilia morbi enim, arcu risus mus mauris elementum pulvinar, laoreet bibendum convallis senectus ullamcorper malesuada. +
+
+
+
+`; diff --git a/apps/codeforafrica/src/components/Partner/Partner.test.js b/apps/codeforafrica/src/components/Partner/Partner.test.js new file mode 100644 index 000000000..fec4ef031 --- /dev/null +++ b/apps/codeforafrica/src/components/Partner/Partner.test.js @@ -0,0 +1,30 @@ +import { createRender } from "@commons-ui/testing-library"; +import React from "react"; + +import Partner from "./Partner"; + +import theme from "@/codeforafrica/theme"; + +// eslint-disable-next-line testing-library/render-result-naming-convention +const render = createRender({ theme }); + +const defaultProps = { + description: [ + { + text: "Lorem ipsum dolor sit amet consectetur adipiscing, elit ac primis praesent", + }, + { + text: "tempor luctus libero, curae condimentum ultricies proin leo. Arcu ornare dis fermentum nisi consequat imperdiet porta viverra placerat nullam, dapibus molestie faucibus id mi lacinia orci magnis. Ridiculus aptent phasellus mus nisi porta rutrum tellus, ut venenatis feugiat massa volutpat. ", + }, + { + text: "Duis maecenas per erat odio quisque accumsan, donec tempus class euismod vulputate fermentum imperdiet, suspendisse blandit lacinia semper cursus. Neque tristique posuere a feugiat convallis tempor cras nunc, leo faucibus cum aptent placerat aenean lobortis, nibh iaculis ac nascetur praesent mus quisque. Nullam leo rutrum augue urna cubilia morbi enim, arcu risus mus mauris elementum pulvinar, laoreet bibendum convallis senectus ullamcorper malesuada.", + }, + ], +}; + +describe("", () => { + it("renders unchanged", () => { + const { container } = render(); + expect(container).toMatchSnapshot(); + }); +}); diff --git a/apps/codeforafrica/src/components/Partner/index.js b/apps/codeforafrica/src/components/Partner/index.js new file mode 100644 index 000000000..e10539fb2 --- /dev/null +++ b/apps/codeforafrica/src/components/Partner/index.js @@ -0,0 +1,3 @@ +import Partner from "./Partner"; + +export default Partner; diff --git a/apps/codeforafrica/src/components/SinglePartner/index.js b/apps/codeforafrica/src/components/SinglePartner/index.js deleted file mode 100644 index 294276edc..000000000 --- a/apps/codeforafrica/src/components/SinglePartner/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import SinglePartner from "./SinglePartner"; - -export default SinglePartner; diff --git a/apps/codeforafrica/src/lib/data/blockify/index.js b/apps/codeforafrica/src/lib/data/blockify/index.js index 289f084f9..8b522d11e 100644 --- a/apps/codeforafrica/src/lib/data/blockify/index.js +++ b/apps/codeforafrica/src/lib/data/blockify/index.js @@ -6,7 +6,7 @@ const propsifyBlockBySlug = { async function blockify(blocks) { const promises = blocks?.map(async (block) => { - const slug = block.blockType ?? block.slug ?? null; + const slug = block.blockType; const propsifyBlock = propsifyBlockBySlug[slug]; if (propsifyBlock) { diff --git a/apps/codeforafrica/src/lib/data/pagify/index.js b/apps/codeforafrica/src/lib/data/pagify/index.js index 3890d83e1..925cb12e2 100644 --- a/apps/codeforafrica/src/lib/data/pagify/index.js +++ b/apps/codeforafrica/src/lib/data/pagify/index.js @@ -7,7 +7,7 @@ const COLLECTION_BY_SLUG = { async function pagify(parentPage, api, context) { const { slug: collection } = parentPage; const pageProps = COLLECTION_BY_SLUG[collection]; - return pageProps(api, context); + return pageProps?.(api, context); } export default pagify; diff --git a/apps/codeforafrica/src/lib/data/pagify/partners.js b/apps/codeforafrica/src/lib/data/pagify/partners.js index 7ee482333..37bca29ae 100644 --- a/apps/codeforafrica/src/lib/data/pagify/partners.js +++ b/apps/codeforafrica/src/lib/data/pagify/partners.js @@ -18,7 +18,7 @@ async function partners(api, context) { { relatedProjects: [], // TODO(koechkevin) Related projects go here once projects implemented ...partner, - slug: "partner", + blockType: "partner", }, ], }; diff --git a/apps/codeforafrica/src/pages/[...slugs].page.js b/apps/codeforafrica/src/pages/[...slugs].page.js index ad1a32dc3..159e28a63 100644 --- a/apps/codeforafrica/src/pages/[...slugs].page.js +++ b/apps/codeforafrica/src/pages/[...slugs].page.js @@ -9,7 +9,7 @@ import MeetOurTeam from "@/codeforafrica/components/MeetOurTeam"; import NewsAndStories from "@/codeforafrica/components/NewsAndStories"; import OurPartners from "@/codeforafrica/components/OurPartners"; import PageHeader from "@/codeforafrica/components/PageHeader"; -import SinglePartner from "@/codeforafrica/components/SinglePartner"; +import Partner from "@/codeforafrica/components/Partner"; import { getPageServerSideProps } from "@/codeforafrica/lib/data"; const componentsBySlugs = { @@ -21,7 +21,7 @@ const componentsBySlugs = { "our-impact": GetInvolved, "our-partners": OurPartners, projects: FeaturedProjects, - partner: SinglePartner, + partner: Partner, }; function Index({ blocks, fallback }) { diff --git a/apps/codeforafrica/src/payload/blocks/OurPartners.js b/apps/codeforafrica/src/payload/blocks/OurPartners.js index a5bc5b132..8554afd10 100644 --- a/apps/codeforafrica/src/payload/blocks/OurPartners.js +++ b/apps/codeforafrica/src/payload/blocks/OurPartners.js @@ -1,7 +1,7 @@ const Partners = { slug: "our-partners", imageURL: "/images/cms/blocks/partners.png", - imageAltText: "Our Partners List", + imageAltText: "Our Partners", labels: { singular: { en: "Partners",