+ {/* Header */}
+
+
+ Posts Gallery
+
+
+ Explore {posts.length} amazing posts
+
+
+
+ {/* Search Input */}
+
+
+
+
setSearchQuery(e.target.value)}
+ className='w-full rounded-2xl border-2 border-gray-200 bg-white py-4 pl-12 pr-4 text-gray-900 shadow-lg transition-all duration-300 placeholder:text-gray-400 focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-100'
+ />
+ {searchQuery && (
+
+ )}
+
+ {searchQuery && (
+
+ Found {filteredPosts.length} post
+ {filteredPosts.length !== 1 ? 's' : ''}
+
+ )}
+
+
+ {/* Loading State */}
+ {loading && (
+
+ )}
+
+ {/* Error State */}
+ {error && (
+
+
+
+ Error Loading Posts
+
+
{error}
+
+ )}
+
+ {/* Posts Grid */}
+ {!loading && !error && (
+ <>
+ {filteredPosts.length === 0 ? (
+
+
+
+ No posts found
+
+
Try adjusting your search query
+
+ ) : (
+
+ {filteredPosts.map((post) => (
+
+ {/* Gradient accent */}
+
+
+ {/* Post number badge */}
+
+
+ Post #{post.id}
+
+
+
+
+ {/* Title */}
+
+ {post.title}
+
+
+ {/* Body */}
+
+ {post.body}
+
+
+ {/* Hover effect overlay */}
+
+
+ ))}
+
+ )}
+ >
+ )}
+
+