import dayjs from 'dayjs' import Image from 'next/image' import Link from 'next/link' import AuthorAvatars from './AuthorAvatars' import authors from '@/lib/authors.json' import { BLOG_PLACEHOLDER_IMAGE, getBlogThumbnailImage } from '@/lib/blog-images' import type Author from '@/types/author' import type PostTypes from '@/types/post' interface Props { post: PostTypes } const BlogGridItem = ({ post }: Props) => { const authorArray: string[] | undefined = post.author ? post.author.split(',') : [] const author = [] if (authorArray) { for (let i = 0; i < authorArray.length; i++) { author.push( authors.find((authors: Author) => { return authors.author_id === authorArray[i] }) ) } } const imageUrl = getBlogThumbnailImage(post) ?? BLOG_PLACEHOLDER_IMAGE return (
{post.description}
{post.date && (Published {dayjs(post.date).format('D MMM YYYY')}
{post.readingTime && ( <>{post.readingTime}
> )}