'use client'; import { useState } from 'react'; import { type Post } from 'contentlayer/generated'; import { PageControls } from '@/components/page-controls'; import { PostCard } from '@/components/post-card'; type PostPaginatorProps = { posts: Post[]; postsPerPage?: number; }; export function PostPaginator({ posts, postsPerPage = 5 }: PostPaginatorProps) { const [currentPage, setCurrentPage] = useState(1); const lastPage = Math.ceil(posts.length / postsPerPage); return (
{posts .slice((currentPage - 1) * postsPerPage, currentPage * postsPerPage) .map((post) => ( ))}
); }