Hi! I'm building a ecommerce store and am trying to make a Search Bar that works functional with my product/ProductReel. My productReel is made with Payload CMS so there are categories for each project (For example Software, Courses, Design). I would like customers to Search For one of there payload values/categories and it takes them to the /store page and only shows them the value/category they search for.
Here is My Code:
Search-Bar on my homepage/page.tsx:
<div className="mt-6 w-full max-w-md relative">
<input
type="text"
className="mt-2 w-full px-4 py-2 border rounded-full shadow-xl focus:outline-none focus:ring-2 focus:ring-indigo-500 pr-10"
placeholder="Search 'Courses'"
value={searchTerm}
onChange={handleInputChange}
onKeyPress={handleKeyPress} // Added to handle Enter key press
/>
<button
className="absolute right-4 top-7 transform -translate-y-1/2"
onClick={handleSearch}
>
<Search className="text-indigo-500" />
</button>
</div>
Here is an example of my ProductReel in action:
<ProductReel
query={{ sort: "desc", limit: 4 }}
href="/store"
title="Brand New"
/>
If anyone needs any other files lmk ill dm them to u!!! Also thanks for the help!!!!!!