Files
juwan-frontend/components/post-comment-count.tsx
T

22 lines
492 B
TypeScript

"use client"
import { useCommentStore } from "@/store/comments"
import { MessageCircle } from "lucide-react"
interface PostCommentCountProps {
postId: string
}
export function PostCommentCount({ postId }: PostCommentCountProps) {
const count = useCommentStore(
(state) => state.comments.filter((comment) => comment.postId === postId).length,
)
return (
<span className="flex items-center gap-1">
<MessageCircle className="h-4 w-4" />
{count}
</span>
)
}