File size: 1,069 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import PostPreview from "../components/post-preview";
export default function MoreStories({ title, posts }) {
return (
<section>
<h2 className="mb-8 text-6xl md:text-7xl font-bold tracking-tighter leading-tight">
{title}
</h2>
<div className="grid grid-cols-1 md:grid-cols-2 md:gap-x-16 lg:gap-x-32 gap-y-20 md:gap-y-32 mb-32">
{posts.map((post) => (
<PostPreview
key={post.slug}
title={post.title}
coverImage={post.coverImage}
date={post.date}
author={post.author}
slug={post.slug}
excerpt={post.excerpt}
/>
))}
</div>
</section>
);
}
// The data returned here will be send as `props` to the component
MoreStories.getCustomInitialProps = async function ({
client,
item,
pageInSitemap,
}) {
const postToExcludeContentID = pageInSitemap.contentID ?? -1;
const posts = await client.getPostsForMoreStories({ postToExcludeContentID });
return {
title: item.fields.title,
posts,
};
};
|