reverted back to old postcard

onClick doesn't want to work, even with the islands, so back to the
drawing board
This commit is contained in:
2025-07-15 23:20:34 -04:00
parent d58538599c
commit 109f8826ff

View File

@@ -3,19 +3,9 @@ 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 (
<div
class="p-6 bg-[#45475a] rounded-lg shadow-md transition-all duration-300 ease-in-out hover:shadow-xl hover:scale-105 cursor-pointer"
onClick={handleCardClick}
>
<div class="p-6 bg-[#45475a] rounded-lg shadow-md transition-all duration-300 ease-in-out hover:shadow-xl hover:scale-105">
<a href={`${Deno.env.get("BASE_URI_WEB")}/posts/${post.post_id}`}>
<h2 class="text-white text-lg font-bold mb-2">{post.title}</h2>
<p class="text-white">
Written by{" "}
@@ -28,6 +18,7 @@ export const PostCard = function PostCard({ post }: { post: Post }) {
at {convertUtc(post.created_at)}
</p>
<p class="text-gray-400">{truncateString(post.body, 15)}</p>
</a>
</div>
);
};