Cover image for My Top 10 Books and Why I Love Them

My Top 10 Books and Why I Love Them

Discover my top 10 favorite books and the profound impact they've had on me.

h1 h1

h2 h2

h3 h3

text text-bold text-italic link ✅🥳😱 text text-bold text-italic link ✅🥳😱

Quote Quote

"use client";

import { useRouter } from 'next/router';
import Image from 'next/image';

const BlogSection = ({ posts }) => {
  const router = useRouter();

  const handleNavigate = (slug) => {
    if (document.startViewTransition) {
      document.startViewTransition(() => router.push(`/blog/${slug}`));
    } else {
      router.push(`/blog/${slug}`);
    }
  };

  return (
    <section className="max-w-4xl mx-auto mt-20">
      <h2 className="text-3xl font-bold mb-8">Latest Posts</h2>
      <div className="grid gap-8 md:grid-cols-2">
        {posts.map((post) => (
          <article
            key={post.id}
            onClick={() => handleNavigate(post.slug)}
            className="border border-gray-200 rounded-lg p-6 hover:shadow-lg transition-shadow flex flex-col cursor-pointer"
          >
            <div
              className="h-40 relative rounded-md overflow-hidden shadow-md mb-4"
              data-view-transition-name={`cover-image-${post.id}`}
            >
              {post.coverUrl ? (
                <Image
                  src={post.coverUrl}
                  alt={post.title}
                  fill
                  className="object-cover"
                />
              ) : (
                <div>Image fallback</div>
              )}
            </div>
            <h3 className="text-xl font-semibold mb-2">{post.title}</h3>
            <p className="text-gray-600 mb-4 flex-grow">{post.summary}</p>
            <div className="flex items-center justify-between">
              <span className="text-sm text-gray-500">
                {formatDate(post.date)}
              </span>
              <span className="text-blue-500 hover:underline">Read more →</span>
            </div>
          </article>
        ))}
      </div>
    </section>
  );
};

export default BlogSection;

💡 This is some code inside a callout:

  const handleNavigate = (slug) => {  
    if (document.startViewTransition) {  
      document.startViewTransition(() => router.push(`/blog/${slug}`));  
    } else {  
      router.push(`/blog/${slug}`);  
    }  
  };  

This is an image inside a callout:

DALLE_2024-10-19_08.53.27_-_A_black_and_white_illustration_in_a_16_9_aspect_ratio_similar_to_the_previous_one_with_a_joyful_and_partyful_atmosphere_but_with_fewer_scribble-like.webp
DALLE_2024-10-19_08.53.27_-_A_black_and_white_illustration_in_a_16_9_aspect_ratio_similar_to_the_previous_one_with_a_joyful_and_partyful_atmosphere_but_with_fewer_scribble-like.webp
Yeah even image captions
Yeah even image captions
column1column2
row1row1
row2row2
image.png
image.png