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,31 +3,22 @@ import { truncateString } from "../lib/truncate.ts";
import { Post } from "../types/index.ts"; import { Post } from "../types/index.ts";
export const PostCard = function PostCard({ post }: { post: Post }) { 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 ( return (
<div <div class="p-6 bg-[#45475a] rounded-lg shadow-md transition-all duration-300 ease-in-out hover:shadow-xl hover:scale-105">
class="p-6 bg-[#45475a] rounded-lg shadow-md transition-all duration-300 ease-in-out hover:shadow-xl hover:scale-105 cursor-pointer" <a href={`${Deno.env.get("BASE_URI_WEB")}/posts/${post.post_id}`}>
onClick={handleCardClick} <h2 class="text-white text-lg font-bold mb-2">{post.title}</h2>
> <p class="text-white">
<h2 class="text-white text-lg font-bold mb-2">{post.title}</h2> Written by{" "}
<p class="text-white"> <a
Written by{" "} class="text-white transition-all duration-300 ease-in-out hover:text-[#74c7ec] hover:drop-shadow-[0_0_10px_rgba(96,165,250,0.7)] hover:scale-110 cursor-pointer"
<a href={`${Deno.env.get("BASE_URI_WEB")}/authors/${post.author_id}`}
class="text-white transition-all duration-300 ease-in-out hover:text-[#74c7ec] hover:drop-shadow-[0_0_10px_rgba(96,165,250,0.7)] hover:scale-110 cursor-pointer" >
href={`${Deno.env.get("BASE_URI_WEB")}/authors/${post.author_id}`} {post.first_name} {post.last_name}
> </a>{" "}
{post.first_name} {post.last_name} at {convertUtc(post.created_at)}
</a>{" "} </p>
at {convertUtc(post.created_at)} <p class="text-gray-400">{truncateString(post.body, 15)}</p>
</p> </a>
<p class="text-gray-400">{truncateString(post.body, 15)}</p>
</div> </div>
); );
}; };