import React, { useState } from 'react'; import { Search } from 'lucide-react'; export default function SearchUI() { const [searchValue, setSearchValue] = useState(''); const [showSuggestions, setShowSuggestions] = useState(false); // Sample suggestions data - you can replace with dynamic data const allSuggestions = [ 'Bride profiles', 'Groom profiles', 'Hindu matrimony', 'Christian matrimony', 'Muslim matrimony', 'Tamil bride', 'Tamil groom', 'Telugu matrimony', 'Kannada matrimony', 'Malayalam matrimony', 'Marathi matrimony', 'North Indian bride', 'Caste based search', 'Community matches', 'Horoscope matching', 'Verified profiles', 'Premium matches', 'Divorced / Widowed profiles', 'NRI matrimony', 'Professional matches', 'Doctor groom', 'Engineer bride', 'IT professional matches', 'Age based search', 'Height based search', 'Education based matches', 'Location based matches', 'Same mother tongue profiles', 'Partner preference search', 'Wedding matchmaking', ]; // Filter suggestions based on search value const filteredSuggestions = searchValue.trim() ? allSuggestions.filter(suggestion => suggestion.toLowerCase().includes(searchValue.toLowerCase()) ) : []; const handleSuggestionClick = (suggestion) => { setSearchValue(suggestion); setShowSuggestions(false); }; const handleSearch = () => { console.log('Searching for:', searchValue); setShowSuggestions(false); }; return (
{/* Search Container */}
{/* Shadow/Glow Effect */}
{/* Main Search Bar */}
{/* Search Input */} { setSearchValue(e.target.value); setShowSuggestions(true); }} onFocus={() => setShowSuggestions(true)} onKeyDown={(e) => { if (e.key === 'Enter') { handleSearch(); } }} placeholder="Search" className="md:flex-1 md:px-8 px-2 py-2 text-lg text-gray-700 placeholder-red-600 bg-transparent outline-none font-medium" /> {/* Search Button */}
{/* Suggestions Dropdown */} {showSuggestions && filteredSuggestions.length > 0 && (
{filteredSuggestions.map((suggestion, index) => ( ))}
)}
{/* Click outside to close suggestions */} {showSuggestions && (
setShowSuggestions(false)} /> )}
); }