-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #594 from CodeForAfrica/ft/codeforafrica-impact
Ft/codeforafrica Impact collection
- Loading branch information
Showing
15 changed files
with
140 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { imageFromMedia } from "@/codeforafrica/lib/data/utils"; | ||
|
||
function ourImpact(block) { | ||
const { impacts, ...other } = block; | ||
const ourImpacts = impacts.map((impact) => { | ||
const { icon: media, title, ...rest } = impact; | ||
const image = imageFromMedia({ alt: title, ...media }); | ||
return { | ||
...rest, | ||
image, | ||
title, | ||
}; | ||
}); | ||
|
||
return { | ||
...other, | ||
impacts: ourImpacts, | ||
slug: "our-impact", | ||
}; | ||
} | ||
|
||
export default ourImpact; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import impacts from "../fields/impacts"; | ||
|
||
const OurImpact = { | ||
slug: "our-impact", | ||
imageURL: "/images/cms/blocks/our_impact.jpg", | ||
imageAltText: "Show Our Impact", | ||
fields: [ | ||
{ | ||
name: "title", | ||
label: "Title", | ||
type: "text", | ||
required: true, | ||
}, | ||
impacts({ | ||
minRows: 1, | ||
}), | ||
], | ||
}; | ||
|
||
export default OurImpact; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import image from "../fields/image"; | ||
import richText from "../fields/richText"; | ||
|
||
const Impact = { | ||
slug: "impact", | ||
admin: { | ||
useAsTitle: "title", | ||
defaultColumns: ["title", "value"], | ||
}, | ||
access: { | ||
read: () => true, | ||
}, | ||
fields: [ | ||
{ | ||
name: "title", | ||
label: "Title", | ||
type: "text", | ||
required: true, | ||
}, | ||
richText({ | ||
name: "description", | ||
}), | ||
{ | ||
name: "value", | ||
label: "Value", | ||
type: "number", | ||
required: true, | ||
min: 1, | ||
}, | ||
image({ | ||
overrides: { | ||
name: "icon", | ||
label: "Icon", | ||
required: true, | ||
}, | ||
}), | ||
], | ||
}; | ||
export default Impact; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { deepmerge } from "@mui/utils"; | ||
|
||
const impacts = (overrides) => | ||
deepmerge( | ||
{ | ||
name: "impacts", | ||
type: "relationship", | ||
relationTo: "impact", | ||
hasMany: true, | ||
}, | ||
overrides, | ||
); | ||
|
||
export default impacts; |