import { convertUtc } from "../lib/convertUtc.ts"; import { truncateString } from "../lib/truncate.ts"; import { Post } from "../types/index.ts"; export const PostCard = function PostCard({ post }: { post: Post }) { const handleCardClick = (e: MouseEvent) => { // Don't navigate if clicking on the author link if ((e.target as HTMLElement).closest("a")) { return; } window.location.href = `${Deno.env.get("BASE_URI_WEB")}/posts/${post.post_id}`; }; return (
Written by{" "} {post.first_name} {post.last_name} {" "} at {convertUtc(post.created_at)}
{truncateString(post.body, 15)}