'use client'; import React, { useState, useEffect } from 'react'; import { MediumCard } from '../src/components/MediumCard'; import { SearchBar } from '../src/components/SearchBar'; import { Tag } from '../src/components/Tag'; import { blogPosts } from '../src/data/blogPosts'; export default function HomePage() { const [searchQuery, setSearchQuery] = useState(''); const [filteredPosts, setFilteredPosts] = useState(blogPosts); // Sort posts by date const allPosts = [...blogPosts].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime() ); // Get unique tags const allTags = Array.from(new Set(allPosts.flatMap(post => post.tags || []))); useEffect(() => { const query = searchQuery.toLowerCase().trim(); if (query.startsWith('#')) { const tag = query.slice(1); setFilteredPosts(allPosts.filter(post => post.tags?.some(t => t.toLowerCase() === tag.toLowerCase()) )); } else { setFilteredPosts(allPosts.filter(post => { const title = post.title.toLowerCase(); const description = post.description.toLowerCase(); const tags = (post.tags || []).join(' ').toLowerCase(); return title.includes(query) || description.includes(query) || tags.includes(query); })); } }, [searchQuery]); const filterByTag = (tag: string) => { setSearchQuery(`#${tag}`); }; return ( <> {/* Clean Hero Section */} {/* Animated Background */} {/* Morphing Blob */} {/* Animated Drawing Paths */} {/* Floating Shapes */} Marc Mintel "A public notebook of things I figured out, mistakes I made, and tools I tested." Vulkaneifel, Germany • Digital problem solver {/* Search */} {/* Topics */} {allTags.length > 0 && ( Topics {allTags.map((tag, index) => ( filterByTag(tag)} className="inline-block" > ))} )} {/* All Posts */} {filteredPosts.length === 0 ? ( No posts found matching your criteria. ) : ( filteredPosts.map(post => ( )) )} > ); }
"A public notebook of things I figured out, mistakes I made, and tools I tested."
No posts found matching your criteria.