import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { KeywordBadge } from '@/components/ui/keyword-badge'; import Footer from '@/pages/home/partials/Footer'; import { Link, router } from '@inertiajs/react'; import { Edit, Search } from 'lucide-react'; import { useState } from 'react'; import { route } from 'ziggy-js'; import BrandLogo from '../home/partials/BrandLogo'; interface MemeMedia { ids: string; name: string; description: string; keywords: string[]; action_keywords: string[]; emotion_keywords: string[]; misc_keywords: string[]; mov_url: string; webm_url: string; gif_url: string; webp_url: string; slug: string; } interface PaginationLinks { url: string | null; label: string; active: boolean; } interface PaginatedMemes { data: MemeMedia[]; current_page: number; last_page: number; per_page: number; total: number; links: PaginationLinks[]; } interface Props { memes: PaginatedMemes; types: string[]; popularKeywords: string[]; filters: { search?: string; }; } export default function MemesIndex({ memes, popularKeywords, filters }: Props) { const [search, setSearch] = useState(filters.search || ''); const handleSearch = (e: React.FormEvent) => { e.preventDefault(); navigateToSearch(search); }; const handleKeywordClick = (keyword: string) => { setSearch(keyword); navigateToSearch(keyword); }; const navigateToSearch = (searchTerm: string) => { if (!searchTerm.trim()) { router.get(route('memes.index')); return; } const trimmedSearch = searchTerm.trim(); // Convert spaces to + for URL segment const urlSegment = trimmedSearch.replace(/\s+/g, '+'); router.get(route('memes.search', urlSegment)); }; const handlePageChange = (url: string) => { router.get(url); }; return ( <>
{/* Header */}

Meme Library

Thousands of memes ready for TikTok, Reels, Threads and YouTube Shorts. No signup needed - click any meme to start creating!

{/* Search and Filters */}
setSearch(e.target.value)} className="h-12 pl-12 text-lg" />
{/* Popular Keywords */}

Popular Keywords

{popularKeywords.map((keyword) => ( ))}
{/* Active Search */} {filters.search && (
Search: {filters.search}
)}
{/* Results Count */}

Showing {memes.data.length} of {memes.total} memes

{/* Memes Grid */}
{memes.data.map((meme) => (
{meme.name}

{meme.name}

{meme.keywords?.slice(0, 6).map((keyword, index) => )} {meme.keywords && meme.keywords.length > 6 && ( +{meme.keywords.length - 6} more )}
))}
{/* Pagination */} {memes.last_page > 1 && (
{memes.links.map((link, index) => (
)}
); }