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) => ( + + ))} +
+ )} +
+ ) +}