2022-06-14 20:58:06 +10:00
|
|
|
import "../components/main"
|
|
|
|
|
import getConfig from 'next/config'
|
|
|
|
|
import Layout from "../components/main"
|
|
|
|
|
import StoryPager from "../components/storypager"
|
2022-06-18 15:14:44 +10:00
|
|
|
import { getAllPosts, getProjectDetails } from "../data/external/cms";
|
2022-06-14 20:58:06 +10:00
|
|
|
//import { popStoryPager } from "../data/external/cms"
|
|
|
|
|
|
|
|
|
|
export async function getServerSideProps(context) {
|
|
|
|
|
if(context.query.page == null || context.query.page == '0') {
|
|
|
|
|
var page = 0;
|
|
|
|
|
} else {
|
|
|
|
|
var page = Number(context.query.page) - 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
|
|
|
|
|
|
2022-06-18 15:14:44 +10:00
|
|
|
const project = await getProjectDetails('tech-and-disability')
|
|
|
|
|
|
|
|
|
|
const articles = await getAllPosts(project.data[0].attributes.tags, page, 5)
|
2022-06-14 20:58:06 +10:00
|
|
|
|
|
|
|
|
const secres = await fetch(serverRuntimeConfig.base_path + `/api/sections`)
|
|
|
|
|
const secdata = await secres.json()
|
|
|
|
|
|
|
|
|
|
const pagedata = {'title': 'Tech and Disability'}
|
|
|
|
|
|
|
|
|
|
return {
|
2022-06-18 15:14:44 +10:00
|
|
|
props: { articles, sections : secdata, pagedata, project }, // will be passed to the page component as props
|
2022-06-14 20:58:06 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-18 15:14:44 +10:00
|
|
|
function Project({ articles, sections, pagedata, project }) {
|
2022-06-14 20:58:06 +10:00
|
|
|
return <Layout sections={sections} pagedata={pagedata}>
|
2022-06-18 15:14:44 +10:00
|
|
|
<h1>{project.data[0].attributes.Title}</h1>
|
|
|
|
|
<div dangerouslySetInnerHTML={{ __html: project.data[0].attributes.Description }}></div>
|
2022-06-14 20:58:06 +10:00
|
|
|
<StoryPager storydata={articles} />
|
|
|
|
|
</Layout>
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-18 15:14:44 +10:00
|
|
|
export default Project
|