import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { router } from '@inertiajs/react'; import { Search } from 'lucide-react'; import { useState } from 'react'; import { route } from 'ziggy-js'; const MemeLibrarySearch = () => { const [searchQuery, setSearchQuery] = useState(''); const [isSearching, setIsSearching] = useState(false); const handleSearch = (e) => { e.preventDefault(); if (!searchQuery.trim()) { // If empty search, go to main meme library router.visit(route('memes.index')); return; } setIsSearching(true); // Navigate to search results page router.visit(route('memes.search', { search: searchQuery.trim() }), { onFinish: () => setIsSearching(false), }); }; const handleKeyPress = (e) => { if (e.key === 'Enter') { handleSearch(e); } }; return (
{/* Section heading */}

Explore Our Meme Library

Search through our database of popular meme templates and find the perfect one for your video

{/* Search form */}
setSearchQuery(e.target.value)} onKeyPress={handleKeyPress} className="h-12 py-3 pr-4 pl-10 text-base" disabled={isSearching} />
{/* Browse all link */}
); }; export default MemeLibrarySearch;