From 9f22f37f8f2e8232c3039868f021356d92b1351f Mon Sep 17 00:00:00 2001 From: Sourabh782 Date: Sat, 3 Aug 2024 22:23:06 +0530 Subject: [PATCH 1/2] Added Enter to search functionality in posts page --- frontend/src/pages/Posts.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/Posts.tsx b/frontend/src/pages/Posts.tsx index 5a94df8b..10895baf 100644 --- a/frontend/src/pages/Posts.tsx +++ b/frontend/src/pages/Posts.tsx @@ -77,6 +77,7 @@ const Posts = () => { const handleSearch = () => { fetchPosts(page, 12, searchQuery, filterTags); + // console.log(searchQuery) }; if (loading) { @@ -165,7 +166,12 @@ const Posts = () => { onChange={(e) => setSearchQuery(e.target.value)} placeholder="🔍 Search anything" className="p-2 w-full max-w-xs rounded-md text-[#000435] bg-white dark:text-white dark:bg-[#000435] border border-sky-400 focus:outline-none focus:ring-2 focus:ring-blue-500" - /> + onKeyDown={(event)=>{ + if(event.key == "Enter"){ + handleSearch() + } + }} + />