add username

This commit is contained in:
john 2025-05-04 00:31:46 +02:00
parent e29b68a907
commit e0a2224544

View file

@ -1,4 +1,5 @@
import { Post } from '../model/posts/posts.ts'
import { Link } from 'react-router'
interface PostItemProps {
post: Post
@ -15,7 +16,12 @@ export default function PostItem({ post }: PostItemProps) {
return (
<article className="w-full p-4" key={post.postId}>
<div className="text-sm text-gray-500 mb-3">{formattedDate}</div>
<div className="text-sm text-gray-500 mb-3">
<Link to={`/u/${post.authorName}`} className="text-gray-400 hover:underline mr-2">
@{post.authorName}
</Link>
{formattedDate}
</div>
<div className="text-gray-800 mb-4 whitespace-pre-wrap">{post.content}</div>