import { GetServerSideProps } from 'next' import { MainContextT, MainContext, getMainContext } from 'components/context/MainContext' import React from 'react' import { DefaultLayout } from 'components/DefaultLayout' import { useTranslation } from 'components/hooks/useTranslation' import { ArticleList } from 'components/landing/ArticleList' import { HomePageHero } from 'components/homepage/HomePageHero' import { ProductSelections } from 'components/homepage/ProductSelections' type FeaturedLink = { href: string title: string intro: string } type Props = { mainContext: MainContextT popularLinks: Array gettingStartedLinks: Array } export default function MainHomePage({ mainContext, gettingStartedLinks, popularLinks }: Props) { return ( ) } type HomePageProps = { popularLinks: Array gettingStartedLinks: Array } function HomePage(props: HomePageProps) { const { gettingStartedLinks, popularLinks } = props const { t } = useTranslation(['toc']) return (
) } export const getServerSideProps: GetServerSideProps = async (context) => { const req = context.req as any const res = context.res as any return { props: { mainContext: getMainContext(req, res), gettingStartedLinks: req.context.featuredLinks.gettingStarted.map( ({ title, href, intro }: any) => ({ title, href, intro }) ), popularLinks: req.context.featuredLinks.popular.map(({ title, href, intro }: any) => ({ title, href, intro, })), }, } }