diff --git a/apps/codeforafrica/src/components/Project/Project.js b/apps/codeforafrica/src/components/Project/Project.js new file mode 100644 index 000000000..3e4376c41 --- /dev/null +++ b/apps/codeforafrica/src/components/Project/Project.js @@ -0,0 +1,90 @@ +import { Section } from "@commons-ui/core"; +import { Box } from "@mui/material"; +import React from "react"; + +import AccoladeBadgeList from "@/codeforafrica/components/AccoladeBadgeList"; +import ProjectDetails from "@/codeforafrica/components/ProjectDetails"; +import ProjectPageHeader from "@/codeforafrica/components/ProjectPageHeader"; +import RelatedProjects from "@/codeforafrica/components/RelatedProjects"; +import RelatedStories from "@/codeforafrica/components/RelatedStories"; +import SectionDivider from "@/codeforafrica/components/SectionDivider"; +import TeamMembers from "@/codeforafrica/components/TeamMembers"; + +function Project(props) { + const { + badges, + description, + donors, + links, + partners, + relatedProjectsTitle, + relatedProjects, + team, + stories, + } = props; + + return ( + + +
+ +
+ + {stories ? ( + <> + + {" "} + + ) : null} + {team ? ( + <> + + + + ) : null} + + + +
+ ); +} + +export default Project; diff --git a/apps/codeforafrica/src/components/Project/Project.snap.js b/apps/codeforafrica/src/components/Project/Project.snap.js new file mode 100644 index 000000000..5d077a335 --- /dev/null +++ b/apps/codeforafrica/src/components/Project/Project.snap.js @@ -0,0 +1,224 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` renders unchanged 1`] = ` +
+
+
+
+
+ + +
+ +
+
+
+

+
+ +

+

+

+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ Details +
+
+
+ Share This Project +
+
+ + + +
+
+
+
+
+
+
+
+ Description +
+
+
+
+
+
+
+
+`; 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} + />