Skip to content

Commit

Permalink
Refractor impact functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinkipruto committed Sep 20, 2023
1 parent 8ad4866 commit 34bc2ad
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion apps/codeforafrica/src/lib/data/blockify/get-involved.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatImpacts } from "./our-impact";
import formatImpacts from "@/codeforafrica/lib/data/utils/impacts";

function getInvolved(block) {
const { impacts, ...other } = block;
Expand Down
14 changes: 1 addition & 13 deletions apps/codeforafrica/src/lib/data/blockify/our-impact.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
import { imageFromMedia } from "@/codeforafrica/lib/data/utils";

export function formatImpacts(impacts) {
return impacts.map((impact) => {
const { icon: media, title, ...rest } = impact;
const image = imageFromMedia({ alt: title, ...media });
return {
...rest,
image,
title,
};
});
}
import formatImpacts from "@/codeforafrica/lib/data/utils/impacts";

function ourImpact(block) {
const { impacts, ...other } = block;
Expand Down
13 changes: 13 additions & 0 deletions apps/codeforafrica/src/lib/data/utils/impacts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { imageFromMedia } from "@/codeforafrica/lib/data/utils";

export default function formatImpacts(impacts) {
return impacts.map((impact) => {
const { icon: media, title, ...rest } = impact;
const image = imageFromMedia({ alt: title, ...media });
return {
...rest,
image,
title,
};
});
}
2 changes: 1 addition & 1 deletion apps/codeforafrica/src/payload/blocks/GetInvolved.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import linkGroup from "../fields/links/linkGroup";
const GetInvolved = {
slug: "get-involved",
imageURL: "/images/cms/blocks/get_involved.jpg",
imageAltText: "Our Impact Statisctics",
imageAltText: "Get Involved",
fields: [
impacts({
minRows: 3,
Expand Down

0 comments on commit 34bc2ad

Please sign in to comment.