2023-10-23 23:11:59 +02:00
|
|
|
import Link from "next/link"
|
|
|
|
import date from "date-and-time"
|
2023-08-01 17:07:19 +02:00
|
|
|
|
2023-10-23 23:11:59 +02:00
|
|
|
import { ShadowContainer } from "@/components/design/ShadowContainer"
|
|
|
|
import { getBlogPosts } from "@/blog/blog"
|
2023-08-01 17:07:19 +02:00
|
|
|
|
|
|
|
export const BlogPosts = async (): Promise<JSX.Element> => {
|
2023-08-01 17:44:08 +02:00
|
|
|
const posts = await getBlogPosts()
|
2023-08-01 17:07:19 +02:00
|
|
|
|
|
|
|
return (
|
2023-10-23 23:11:59 +02:00
|
|
|
<div className="flex w-full items-center justify-center p-8">
|
|
|
|
<div className="w-[1600px]" data-cy="blog-posts">
|
2023-08-01 17:07:19 +02:00
|
|
|
{posts.map((post, index) => {
|
|
|
|
const postPublishedOn = date.format(
|
|
|
|
new Date(post.frontmatter.publishedOn),
|
2023-10-23 23:11:59 +02:00
|
|
|
"DD/MM/YYYY",
|
2023-08-01 17:07:19 +02:00
|
|
|
)
|
|
|
|
return (
|
|
|
|
<Link
|
|
|
|
href={`/blog/${post.slug}`}
|
|
|
|
key={index}
|
2023-10-23 23:11:59 +02:00
|
|
|
locale="en"
|
2023-08-01 17:07:19 +02:00
|
|
|
data-cy={post.slug}
|
|
|
|
>
|
2024-05-16 09:26:05 +02:00
|
|
|
<ShadowContainer className="cursor-pointer p-6 transition-all duration-300 ease-in-out hover:scale-[1.02]">
|
2024-01-28 01:56:47 +01:00
|
|
|
<h2
|
|
|
|
data-cy="blog-post-title"
|
2024-04-06 20:25:02 +02:00
|
|
|
className="text-xl font-semibold text-primary dark:text-primary-dark"
|
2024-01-28 01:56:47 +01:00
|
|
|
>
|
2023-08-01 17:07:19 +02:00
|
|
|
{post.frontmatter.title}
|
|
|
|
</h2>
|
2023-10-23 23:11:59 +02:00
|
|
|
<p data-cy="blog-post-date" className="mt-2">
|
2023-08-01 17:07:19 +02:00
|
|
|
{postPublishedOn}
|
|
|
|
</p>
|
2023-10-23 23:11:59 +02:00
|
|
|
<p data-cy="blog-post-description" className="mt-3">
|
2023-08-01 17:07:19 +02:00
|
|
|
{post.frontmatter.description}
|
|
|
|
</p>
|
|
|
|
</ShadowContainer>
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|