/* eslint-disable-next-line */ import NextImage from "next/image"; import delve from 'dlv'; import {getCategoryUrl, getPostUrl, getStrapiImage, getStrapiImageSize} from "../../libs/utils"; import CardBlog from "../card-blog/card-blog"; import {format} from "date-fns"; export interface HomeSectionBlogProps { posts: object[]; } export function HomeSectionBlog({posts}: HomeSectionBlogProps) { const firstArticle = posts.length > 0 ? posts.slice(0, 1) : []; const otherArticles = posts.length > 0 ? posts.slice(1, posts.length) : []; const [width, height] = getStrapiImageSize(firstArticle[0]); return ( <>
{format(new Date(delve(firstArticle[0], 'attributes.publishedAt', 'Jun 1, 2020')), 'dd/MM/yyyy')}
{delve(firstArticle[0], 'attributes.category.data.attributes.name', 'N/A')}
{delve(firstArticle[0], 'attributes.title', 'N/A')}

{delve(firstArticle[0], 'attributes.description', 'N/A')}

{otherArticles.map((item: object, index: number) => ())}
); } export default HomeSectionBlog;