+`;
diff --git a/apps/codeforafrica/src/components/Project/Project.test.js b/apps/codeforafrica/src/components/Project/Project.test.js
new file mode 100644
index 000000000..19ce985fb
--- /dev/null
+++ b/apps/codeforafrica/src/components/Project/Project.test.js
@@ -0,0 +1,40 @@
+import { createRender } from "@commons-ui/testing-library";
+import React from "react";
+
+import Project from "./Project";
+
+import theme from "@/codeforafrica/theme";
+
+// eslint-disable-next-line testing-library/render-result-naming-convention
+const render = createRender({ theme });
+
+const defaultProps = {
+ project: {
+ slug: "knowledge-africa",
+ name: "knowledgeAFRICA",
+ tagLine: "Knowledge tag line",
+ title:
+ 'Empowering citizens through drone technology',
+ subtitle:
+ "AfricanDRONE brings together communities of drone operators, enthusiasts, journalists, activists, and entrepreneurs in Africa who use drones for good.",
+ description:
+ "This award-winning initiative works to give citizens a new perspective on their lives. Using drone technology, africanDRONE empowers local pilots through a self-help network that offers seed funding, skills development, resource sharing, advocacy, and networking opportunities for members. The goal is to support the evolution of a vibrant and diverse drone ecosystem across Africa.",
+ icon: {
+ src: "https://res.cloudinary.com/code-for-africa/image/upload/v1652431402/codeforafrica/icons/Type_SourceAfrica_m7yvmt.svg",
+ },
+ thumbnail: {
+ src: "https://res.cloudinary.com/code-for-africa/image/upload/v1652705959/codeforafrica/images/Property_1_PesaCheck_iahlrh.jpg",
+ },
+ tag: "Knowedge",
+ href: "/projects/knowledge-africa",
+ externalHref: "https://codeforafrica.org",
+ },
+ sections: [],
+};
+
+describe("", () => {
+ it("renders unchanged", () => {
+ const { container } = render();
+ expect(container).toMatchSnapshot();
+ });
+});
diff --git a/apps/codeforafrica/src/components/Project/index.js b/apps/codeforafrica/src/components/Project/index.js
new file mode 100644
index 000000000..f3c656ec0
--- /dev/null
+++ b/apps/codeforafrica/src/components/Project/index.js
@@ -0,0 +1,3 @@
+import Project from "./Project";
+
+export default Project;
diff --git a/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.js b/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.js
index 83fb25bd0..1b7de5601 100644
--- a/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.js
+++ b/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.js
@@ -4,9 +4,11 @@ import React from "react";
import Button from "./ProjectDescriptionButton";
+import RichText from "@/codeforafrica/components/RichText";
+
const ProjectDescription = React.forwardRef(
function ProjectDescription(props, ref) {
- const { children, links, sx, title, ...other } = props;
+ const { description, links, sx, title, ...other } = props;
if (!title?.length) {
return null;
@@ -19,14 +21,16 @@ const ProjectDescription = React.forwardRef(
ref={ref}
>
{title}
-
- {children}
-
+
{links?.length > 0 ? (
- {links.map(({ content, href, slug }) => (
-
diff --git a/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.snap.js b/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.snap.js
index 1a36215e8..b52607f5e 100644
--- a/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.snap.js
+++ b/apps/codeforafrica/src/components/ProjectDetails/ProjectDescription.snap.js
@@ -20,7 +20,6 @@ exports[` renders unchanged 1`] = `
tabindex="0"
target="_blank"
>
- Github
diff --git a/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.js b/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.js
index 5329fcd30..6e5a50895 100644
--- a/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.js
+++ b/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.js
@@ -6,7 +6,7 @@ import ProjectDescription from "./ProjectDescription";
import ProjectStakeholders from "./ProjectStakeholders";
const ProjectDetails = React.forwardRef(function ProjectDetails(props, ref) {
- const { content, donors, links, partners, ...other } = props;
+ const { description, donors, links, partners, ...other } = props;
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up("md"));
return (
@@ -32,9 +32,11 @@ const ProjectDetails = React.forwardRef(function ProjectDetails(props, ref) {
}}
/>
-
- {content}
-
+
diff --git a/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.snap.js b/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.snap.js
index fbff2bee7..135f6aad6 100644
--- a/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.snap.js
+++ b/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.snap.js
@@ -4,7 +4,6 @@ exports[` renders unchanged 1`] = `
renders unchanged 1`] = `
>
Description
+
+ This award-winning initiative works to give citizens a new perspective on their lives. Using drone technology, africanDRONE empowers local pilots through a self-help network that offers seed funding, skills development, resource sharing, advocacy, and networking opportunities for members. The goal is to support the evolution of a vibrant and diverse drone ecosystem across Africa.
+
@@ -98,7 +102,6 @@ exports[` renders unchanged 1`] = `
tabindex="0"
target="_blank"
>
- Launch Project
@@ -117,7 +120,6 @@ exports[` renders unchanged 1`] = `
tabindex="0"
target="_blank"
>
- GitHub
diff --git a/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.test.js b/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.test.js
index abdc916f8..9965b3be5 100644
--- a/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.test.js
+++ b/apps/codeforafrica/src/components/ProjectDetails/ProjectDetails.test.js
@@ -9,8 +9,11 @@ import theme from "@/codeforafrica/theme";
const render = createRender({ theme });
const defaultProps = {
- description:
- "This award-winning initiative works to give citizens a new perspective on their lives. Using drone technology, africanDRONE empowers local pilots through a self-help network that offers seed funding, skills development, resource sharing, advocacy, and networking opportunities for members. The goal is to support the evolution of a vibrant and diverse drone ecosystem across Africa.",
+ description: [
+ {
+ text: "This award-winning initiative works to give citizens a new perspective on their lives. Using drone technology, africanDRONE empowers local pilots through a self-help network that offers seed funding, skills development, resource sharing, advocacy, and networking opportunities for members. The goal is to support the evolution of a vibrant and diverse drone ecosystem across Africa.",
+ },
+ ],
links: [
{
slug: "data",
diff --git a/apps/codeforafrica/src/components/ProjectPageHeader/ProjectPageHeader.js b/apps/codeforafrica/src/components/ProjectPageHeader/ProjectPageHeader.js
index 474b227ec..baf6f7498 100644
--- a/apps/codeforafrica/src/components/ProjectPageHeader/ProjectPageHeader.js
+++ b/apps/codeforafrica/src/components/ProjectPageHeader/ProjectPageHeader.js
@@ -15,6 +15,7 @@ import ExternalLinkIcon from "@/codeforafrica/assets/icons/Type=external-link, S
import Breadcrumbs from "@/codeforafrica/components/Breadcrumbs";
import ProjectCardMedia from "@/codeforafrica/components/ProjectCardMedia";
import ProjectTile from "@/codeforafrica/components/ProjectTile";
+import RichText from "@/codeforafrica/components/RichText";
import TwoToneBackground from "@/codeforafrica/components/TwoToneBackground";
const Background = styled(TwoToneBackground, {
@@ -124,12 +125,11 @@ const ProjectPageHeader = React.forwardRef(
>
{title}
-
- {subtitle}
-
+ elements={subtitle}
+ />
({
+ name,
+ date: formatDate(date, {
+ includeTime: false,
+ month: "short",
+ }),
+ })),
+ partners: { list: project.partners, title: "Partners" },
+ externalHref: project.externalHref?.url,
+ blockType: "project",
+ },
+ ],
+ };
+}
+
+export default projects;
diff --git a/apps/codeforafrica/src/pages/[...slugs].page.js b/apps/codeforafrica/src/pages/[...slugs].page.js
index 1400e6e65..b86f875ce 100644
--- a/apps/codeforafrica/src/pages/[...slugs].page.js
+++ b/apps/codeforafrica/src/pages/[...slugs].page.js
@@ -16,6 +16,7 @@ import OurPartners from "@/codeforafrica/components/OurPartners";
import OurTeam from "@/codeforafrica/components/OurTeam";
import PageHeader from "@/codeforafrica/components/PageHeader";
import Partner from "@/codeforafrica/components/Partner";
+import Project from "@/codeforafrica/components/Project";
import Projects from "@/codeforafrica/components/Projects";
import { getPageServerSideProps } from "@/codeforafrica/lib/data";
@@ -36,6 +37,7 @@ const componentsBySlugs = {
"our-work": Projects,
projects: FeaturedProjects,
partner: Partner,
+ project: Project,
};
function Index({ blocks, fallback }) {
diff --git a/apps/codeforafrica/src/utils/formatDate.js b/apps/codeforafrica/src/utils/formatDate.js
new file mode 100644
index 000000000..f119f3d84
--- /dev/null
+++ b/apps/codeforafrica/src/utils/formatDate.js
@@ -0,0 +1,23 @@
+const formatDate = (date, options) => {
+ const { locale = "en", includeTime, ...restOptions } = options;
+
+ const formatOptions = {
+ ...(includeTime
+ ? { hour: "numeric", minute: "numeric", second: "2-digit" }
+ : {}),
+ ...restOptions,
+ };
+ try {
+ const formattedDate = new Date(date).toLocaleString(locale, {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ ...formatOptions,
+ });
+ return formattedDate;
+ } catch (error) {
+ return null;
+ }
+};
+
+export default formatDate;