From e29b68a90772658c30ece84ebeb947607b8bf5c6 Mon Sep 17 00:00:00 2001 From: john Date: Sun, 4 May 2025 00:29:02 +0200 Subject: [PATCH] ood --- src/components/PostItem.tsx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/components/PostItem.tsx diff --git a/src/components/PostItem.tsx b/src/components/PostItem.tsx new file mode 100644 index 0000000..cc608df --- /dev/null +++ b/src/components/PostItem.tsx @@ -0,0 +1,31 @@ +import { Post } from '../model/posts/posts.ts' + +interface PostItemProps { + post: Post +} + +export default function PostItem({ post }: PostItemProps) { + const formattedDate = post.createdAt.toLocaleString('en-US', { + year: 'numeric', + month: 'short', + day: 'numeric', + hour: '2-digit', + minute: '2-digit', + }) + + return ( +
+
{formattedDate}
+ +
{post.content}
+ + {post.media.length > 0 && ( +
+ {post.media.map((src) => ( + + ))} +
+ )} +
+ ) +}