diff --git a/pages/guides/index.tsx b/pages/guides/index.tsx index fd5b2c0f5..18a779a76 100644 --- a/pages/guides/index.tsx +++ b/pages/guides/index.tsx @@ -7,8 +7,18 @@ import { UpdatesBanner } from '../../components/updates-banner'; import { Footer } from '../../components/footer'; import { GuideGridItem } from './components/guide-grid-item'; import { PageHeader } from '../../components/page-header'; +import { getAllGuides, getGuideById, GuideType } from '../../lib/guide'; + +type GuidesProps = { + guides: GuideType[] +} + +export default function Guides(props: GuidesProps) { + const { guides = [] } = props; + + const recentGuides = guides.slice(0, 2); + const oldGuides = guides.slice(2); -export default function Guides() { return ( @@ -19,41 +29,28 @@ export default function Guides() { /> - - + {recentGuides.map((recentGuide, counter) => ( + + ))} - - - - - - - - - - - - - - - - - - - - + {oldGuides.map(oldGuide => ( + + ))} @@ -64,3 +61,12 @@ export default function Guides() { ); } + +export async function getStaticProps() { + return { + props: { + guides: getAllGuides() + } + }; +} +