diff --git a/frontend/src/app/projects/page.tsx b/frontend/src/app/projects/page.tsx index 9daa351..39420c9 100644 --- a/frontend/src/app/projects/page.tsx +++ b/frontend/src/app/projects/page.tsx @@ -5,7 +5,6 @@ import { getClient } from "@/lib/ApolloClient"; import { BlocksContent } from "@strapi/blocks-react-renderer"; import Link from "next/link"; import Image from "next/image"; -import BlockRendererClient from "@/components/BlockRendererClient"; const HOST_URL = process.env.HOST_URL; const GET_PROJECTS = gql(` @@ -55,13 +54,15 @@ export default async function ProjectsPage() { } return ( -
-

Our Projects

-

- Information about our various projects are shown here. -

+
+
+

Our Projects

+

+ Information about our various projects are shown here. +

+
-
+
{graphqlData.data.projects.data.map((project) => { let coverImage = project?.attributes?.coverImage?.data?.attributes?.url; @@ -72,39 +73,47 @@ export default async function ProjectsPage() { let content: BlocksContent = project?.attributes?.article ?? []; + let text = ""; + for (const block of content) { if (block.type === "paragraph") { - content = [block]; + const paragraphBlock = block as { + type: "paragraph"; + children: { type: "text"; text: string }[]; + }; + + text = + paragraphBlock.children[0].text.slice(0, 100) + + "..."; + break; } } return ( - - - - + + + + + {coverImage && ( + {coverImage} + )} + {project?.attributes?.title} - - - - - {coverImage && ( - {coverImage} - )} - - - + +

{text}

+ + + ); })}
diff --git a/frontend/src/components/BlockRendererClient.tsx b/frontend/src/components/BlockRendererClient.tsx index 02c14da..99ee21c 100644 --- a/frontend/src/components/BlockRendererClient.tsx +++ b/frontend/src/components/BlockRendererClient.tsx @@ -54,7 +54,7 @@ export default function BlockRendererClient({ paragraph: ({ children }) => ( <> -

{children}

+

{children}


),