-
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 #461 from CodeForAfrica/chore/charterafrica_reuse_…
…page @/charterafrica reuse page
- Loading branch information
Showing
4 changed files
with
12 additions
and
39 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
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 |
---|---|---|
@@ -1,40 +1,10 @@ | ||
import React from "react"; | ||
|
||
import Ecosystem from "@/charterafrica/components/Ecosystem"; | ||
import FocalCountries from "@/charterafrica/components/FocalCountries"; | ||
import Helpdesk from "@/charterafrica/components/Helpdesk"; | ||
import Hero from "@/charterafrica/components/Hero"; | ||
import Infographic from "@/charterafrica/components/Infographic"; | ||
import Mooc from "@/charterafrica/components/Mooc"; | ||
import Partners from "@/charterafrica/components/Partners"; | ||
import Resources from "@/charterafrica/components/Resources"; | ||
import Spotlight from "@/charterafrica/components/Spotlight"; | ||
import { getPageServerSideProps } from "@/charterafrica/lib/data"; | ||
|
||
const componentsBySlugs = { | ||
ecosystem: Ecosystem, | ||
"focal-countries": FocalCountries, | ||
helpdesk: Helpdesk, | ||
hero: Hero, | ||
"aga-infographic": Infographic, | ||
mooc: Mooc, | ||
"our-partners": Partners, | ||
"our-resources": Resources, | ||
spotlight: Spotlight, | ||
}; | ||
|
||
function Index({ blocks }) { | ||
return blocks?.map((block) => { | ||
const Component = componentsBySlugs[block?.slug]; | ||
if (!Component) { | ||
return null; | ||
} | ||
return <Component {...block} key={block.id} />; | ||
}); | ||
} | ||
import Page, { | ||
getServerSideProps as sharedGetServerSideProps, | ||
} from "./[...slugs].page"; | ||
|
||
export async function getServerSideProps(context) { | ||
return getPageServerSideProps(context); | ||
const func = sharedGetServerSideProps.bind(this); | ||
return func(context); | ||
} | ||
|
||
export default Index; | ||
export default Page; |
a06087b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
codeforafrica – ./
codeforafrica-git-main-codeforafrica.vercel.app
codeforafrica.vercel.app
codeforafrica-codeforafrica.vercel.app