Skip to content

Commit

Permalink
Stories block
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinkipruto committed Sep 22, 2023
1 parent d0969a4 commit 13398a2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/codeforafrica/src/lib/data/blockify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import getInvolved from "./get-involved";
import hero from "./hero";
import meetOurTeam from "./meetOurTeam";
import ourImpact from "./our-impact";
import stories from "./stories";

const propsifyBlockBySlug = {
hero,
"meet-our-team": meetOurTeam,
"our-impact": ourImpact,
"get-involved": getInvolved,
"stories-list": stories,
};

async function blockify(blocks) {
Expand Down
32 changes: 32 additions & 0 deletions apps/codeforafrica/src/lib/data/blockify/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { imageFromMedia } from "@/codeforafrica/lib/data/utils";

function stories(block) {
const { featured = {}, title, search, excerpt, ...other } = block;
const {
title: featuredStoryTitle,
coverImage: featuredStoryCoverImage,
excerpt: featuredStoryExcerpt,
} = featured;

const featuredStory = {
title: featuredStoryTitle,
image: imageFromMedia({
alt: featuredStoryTitle,
...featuredStoryCoverImage,
}),
excerpt: featuredStoryExcerpt,
slug: "featured-story",
};

const storiesList = {
...other,
slug: "stories-list",
};

return {
...featuredStory,
storiesList,
};
}

export default stories;
Empty file.

0 comments on commit 13398a2

Please sign in to comment.