import Link from "next/link"; import date from "../lib/date"; import { IPostMeta } from "../lib/slug"; import style from '../styles/recent-posts.module.css'; function RecentPosts({ postsMeta }: { postsMeta: IPostMeta[] }) { if (!postsMeta.length) return <>; return (
Recent Posts
{postsMeta?.slice(0, 10) .map((post: any) => { return
{date.toRelativeDate(new Date(post.created_at))}
{post.title}
})}
{ postsMeta.length > 10 &&
More...
}
); } export default RecentPosts;