import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' import { useRouter } from 'next/router' import Link from 'next/link' export const BlogListPage = props => { const { page = 1, posts, postCount } = props const { locale } = useGlobal() const router = useRouter() const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE) const currentPage = +page const showPrev = currentPage > 1 const showNext = page < totalPage const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') return
{posts?.map(p => ( ))}
{locale.PAGINATION.PREV} {locale.PAGINATION.NEXT}
}