import Link from "next/link"; import { toRelativeDate } from "../lib/date"; import style from '../styles/recent-posts.module.css'; import PostsInfo from '../public/posts.json'; function PostBlock({ slug, otime, title }: { slug: string, otime: string, title: string }) { return (
{toRelativeDate(new Date(otime))}
{title}
); } function RecentPosts() { const posts = Object.entries(PostsInfo).reverse(); if (!posts.length) return <>; return (

Recent Posts

{posts?.slice(0, 10) .map(([slug, post]: any, i: number) => { return ( ); })}
{ posts.length > 10 &&
More...
}
); } export default RecentPosts;