import Card, { CardCta, CardDescription, CardEyebrow, CardTags, CardTitle, } from '@/components/server/Card' import SimpleLayout from '@/components/server/SimpleLayout' import Tag from '@/components/server/Tag' import formatDate from '@/lib/formatDate' import { getFirstBlogPosts } from '@/lib/notion/content/blogPosts' import { SelectColor } from '@/lib/notion/types' import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText' export const revalidate = 600 function BlogPost({ slug, title, description, publishDate, topics, }: { slug: string title: string description: string publishDate: string topics: { name: string; color: SelectColor }[] }) { return (
{title} {formatDate(publishDate)} {description} {topics.map((topic) => ( {topic.name} ))} Lê o artigo {formatDate(publishDate)}
) } export default async function Blog() { const { results: blogPosts } = await getFirstBlogPosts() return (
{blogPosts.map((blogPost) => ( ({ name, color }), )} slug={richTextAsPlainText(blogPost.properties.Slug.rich_text)} publishDate={richTextAsPlainText( blogPost.properties.PublishDate.date?.start ?? blogPost.created_time, )} /> ))}
) }