---
export const prerender = true;


import type { GetStaticPaths } from "astro";

import { PAGE_SIZE } from "@constants/constants";
import { getSortedPosts } from "@utils/content";
import Pagination from "@components/pagination.astro";
import PostPage from "@components/postPage.astro";
import GridLayout from "@layouts/grid.astro";


export const getStaticPaths = (async ({ paginate }) => {
    const allBlogPosts = await getSortedPosts();
    return paginate(allBlogPosts, { pageSize: PAGE_SIZE });
}) satisfies GetStaticPaths;
// https://github.com/withastro/astro/issues/6507#issuecomment-1489916992


const { page } = Astro.props;

const len = page.data.length;
---

<GridLayout>
    <PostPage page={page}></PostPage>
    <Pagination class="mx-auto onload-animation-up" page={page} style={`animation-delay: ${(len)*50}ms`}></Pagination>
</GridLayout>