2022-04-03 23:32:57 +00:00
|
|
|
import Head from 'next/head'
|
|
|
|
import styles from '../styles/Home.module.css'
|
|
|
|
import HeaderNav from '../lib/HeaderNav'
|
|
|
|
import HeroImage from '../lib/HeroImage'
|
|
|
|
import PostsList from '../lib/PostsList'
|
|
|
|
import { getSortedPostsData } from '../lib/posts'
|
2022-04-05 02:18:57 +00:00
|
|
|
import { serialize } from 'next-mdx-remote/serialize'
|
2022-04-03 23:32:57 +00:00
|
|
|
|
|
|
|
export async function getStaticProps() {
|
2022-04-05 02:18:57 +00:00
|
|
|
const allPostsData = await getSortedPostsData(serialize)
|
2022-04-03 23:32:57 +00:00
|
|
|
return {
|
|
|
|
props: {
|
2022-04-05 02:18:57 +00:00
|
|
|
allPostsData,
|
2022-04-03 23:32:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Posts({ allPostsData }) {
|
|
|
|
return (
|
|
|
|
<div className={styles.container}>
|
|
|
|
<HeaderNav />
|
|
|
|
<HeroImage image="https://source.unsplash.com/IIDxzNru2GY/3841x2160" credit={{ url: "https://unsplash.com/photos/IIDxzNru2GY", text: "Csabi Elter" }} withGradient="top-black">
|
|
|
|
Posts
|
|
|
|
</HeroImage>
|
|
|
|
<Head>
|
|
|
|
<title>Posts | Luke Granger-Brown</title>
|
|
|
|
<link rel="icon" href="/favicon.ico" />
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
<main className={styles.main}>
|
|
|
|
<PostsList posts={allPostsData} />
|
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|