-
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.
- Loading branch information
1 parent
45b294c
commit 8c439df
Showing
9 changed files
with
143 additions
and
7 deletions.
There are no files selected for viewing
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
53 changes: 52 additions & 1 deletion
53
apps/codeforafrica/src/components/RelatedStories/RelatedStories.snap.js
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 |
---|---|---|
@@ -1,3 +1,54 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<RelatedStories /> renders unchanged 1`] = `<div />`; | ||
exports[`<RelatedStories /> renders unchanged 1`] = ` | ||
<div> | ||
<div | ||
class="MuiContainer-root MuiContainer-maxWidthLg MuiContainer-fixed MuiContainer-disableGutters css-1pmgh96-MuiContainer-root" | ||
> | ||
<div | ||
class="MuiTypography-root MuiTypography-h5Small css-1v0gnt0-MuiTypography-root" | ||
> | ||
Related Stories | ||
</div> | ||
<div | ||
class="MuiGrid-root MuiGrid-container css-16q497u-MuiGrid-root" | ||
> | ||
<div | ||
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-4 css-1dte7n6-MuiGrid-root" | ||
> | ||
<div | ||
class="MuiPaper-root MuiPaper-outlined MuiCard-root css-1dxfqf3-MuiPaper-root-MuiCard-root" | ||
> | ||
<a | ||
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways MuiButtonBase-root MuiCardActionArea-root css-mfu8qg-MuiTypography-root-MuiLink-root-MuiButtonBase-root-MuiCardActionArea-root" | ||
href="/stories/article-1" | ||
tabindex="0" | ||
> | ||
<img | ||
class="MuiCardMedia-root MuiCardMedia-media MuiCardMedia-img css-gzk243-MuiCardMedia-root" | ||
src="https://res.cloudinary.com/code-for-africa/image/upload/v1650885664/codeforafrica/unsplash_L6hr1BptcNc_of23p3.png" | ||
/> | ||
<div | ||
class="MuiCardContent-root css-q7lov9-MuiCardContent-root" | ||
> | ||
<h6 | ||
class="MuiTypography-root MuiTypography-subtitle1 css-t0ku10-MuiTypography-root" | ||
> | ||
Battle for gender equality in African media continues | ||
</h6> | ||
<span | ||
class="MuiTypography-root MuiTypography-caption css-1xdk20n-MuiTypography-root" | ||
> | ||
Jan 6, 2022 | ||
</span> | ||
</div> | ||
<span | ||
class="MuiCardActionArea-focusHighlight css-1v2exvi-MuiCardActionArea-focusHighlight" | ||
/> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
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,17 @@ | ||
import { getPosts } from "@/codeforafrica/lib/data/utils/posts"; | ||
|
||
async function relatedPosts(block, api) { | ||
const { primaryTag, number, ...other } = block; | ||
|
||
const options = { | ||
limit: number, | ||
}; | ||
const { posts } = await getPosts(api, options, primaryTag); | ||
return { | ||
...other, | ||
posts, | ||
slug: "related-posts", | ||
}; | ||
} | ||
|
||
export default relatedPosts; |
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,51 @@ | ||
const primaryTags = [ | ||
{ | ||
label: "Stories", | ||
value: "stories", | ||
}, | ||
{ | ||
label: "Opportunities", | ||
value: "opportunities", | ||
}, | ||
]; | ||
|
||
const RelatedPosts = { | ||
slug: "related-posts", | ||
imageURL: "/images/cms/blocks/related_posts.jpg", | ||
imageAltText: "Related Posts", | ||
labels: { | ||
singular: { | ||
en: "Related Posts", | ||
}, | ||
plural: { | ||
en: "Related Posts", | ||
}, | ||
}, | ||
fields: [ | ||
{ | ||
name: "title", | ||
label: "Title", | ||
required: true, | ||
type: "text", | ||
}, | ||
{ | ||
name: "primaryTag", | ||
label: "Post Type", | ||
required: true, | ||
type: "select", | ||
options: primaryTags, | ||
hasMany: false, | ||
}, | ||
{ | ||
name: "number", | ||
label: "Number of Posts to Show", | ||
required: true, | ||
type: "number", | ||
min: 1, | ||
max: 3, | ||
defaultValue: 3, | ||
}, | ||
], | ||
}; | ||
|
||
export default RelatedPosts; |
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