Skip to content

Commit

Permalink
Search admin table (#182)
Browse files Browse the repository at this point in the history
* Added Admin Search

* adjusted edit/delete buttons

* Dynamic Update

* removed search button

---------

Co-authored-by: will <wenglandusa@gmail.com>
Co-authored-by: Anthony Malang <anthonymalang@u.boisestate.edu>
  • Loading branch information
3 people authored Nov 30, 2024
1 parent 49a8d22 commit d1c89e7
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/app/admin/adminVendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ export default function VendorsAdmin() {
};


const handleSearch = () => {
const query = searchQuery.toLowerCase();
const handleSearch = (e) => {
const query = e.target.value.toLowerCase();
setSearchQuery(query);
const filtered = data.filter((vendor) =>
(vendor.vendor_name || "").toLowerCase().includes(query)
vendor.vendor_name?.toLowerCase().includes(query)
);
setFilteredData(filtered);
};
Expand Down Expand Up @@ -397,20 +398,12 @@ export default function VendorsAdmin() {
<input
type="text"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
onChange={handleSearch}
placeholder="Search by activity"
className="flex-grow w-full p-2 border rounded"
/>
<button
type="button"
onClick={handleSearch}
className="bg-bsu-blue text-white font-bold hover:bg-orange-500 hover:scale-110 duration-300 px-4 py-2 rounded"
>
Search
</button>
</div>
</div>

{/* Table layout on large screens, Card layout on small screens */}
<div>
{/* Table layout */}
Expand Down

0 comments on commit d1c89e7

Please sign in to comment.