1+ import Image from "next/image"
12import Link from "next/link"
23
4+ import { TPostItem } from "database"
5+ import { useTranslations } from "next-intl"
36import { Typography } from "ui"
47
58import APP_ROUTES from "@/constants/routes"
69import TagList from "@/molecules/tag/tag-list"
7- import { TPostItem } from "@/types/posts"
810import { generatePath } from "@/utils/generatePath"
911
1012import BookmarkButton from "./bookmark-button"
@@ -13,6 +15,8 @@ import LikeButton from "./like-button"
1315import PostMeta from "./post-meta"
1416
1517export default function PostItem ( { post } : { post : TPostItem } ) {
18+ const t = useTranslations ( "common" )
19+
1620 return (
1721 < div className = "mb-4 flex rounded-sm border px-8 py-4" >
1822 < div className = "flex-1" >
@@ -25,7 +29,7 @@ export default function PostItem({ post }: { post: TPostItem }) {
2529 variant = "h2"
2630 className = "hover:underline"
2731 >
28- { post . title }
32+ { post . title || t ( "untitled" ) }
2933 </ Typography >
3034 </ Link >
3135
@@ -43,9 +47,19 @@ export default function PostItem({ post }: { post: TPostItem }) {
4347 < LikeButton post = { post } />
4448 < CommentButton post = { post } />
4549 </ div >
46- < BookmarkButton post = { post } />
4750 </ div >
4851 </ div >
52+ { post . Image && (
53+ < div className = "flex items-center" >
54+ < Image
55+ src = { post . Image . url }
56+ alt = { post . title }
57+ width = { 160 }
58+ height = { 120 }
59+ className = "h-[120px] w-[160px] rounded-sm object-cover"
60+ />
61+ </ div >
62+ ) }
4963 </ div >
5064 )
5165}
0 commit comments