import React, { useRef } from 'react' import Link from 'next/link' import BLOG from '@/blog.config' /** * 博客归档列表 * @param posts 所有文章 * @param archiveTitle 归档标题 * @returns {JSX.Element} * @constructor */ const BlogPostArchive = ({ posts = [], archiveTitle }) => { const targetRef = useRef(null) if (!posts || posts.length === 0) { return <> } else { return
{archiveTitle}
{/* 文章列表 */}
} } /** * 获取从第1页到指定页码的文章 * @param page 第几页 * @param totalPosts 所有文章 * @param postsPerPage 每页文章数量 * @returns {*} */ const getPostByPage = function (page, totalPosts, postsPerPage) { return totalPosts.slice( 0, postsPerPage * page ) } export default BlogPostArchive