Skip to content

Commit

Permalink
Merge pull request #561 from Sourabh782/press-Enter-to-Search
Browse files Browse the repository at this point in the history
Added Enter to search functionality in posts page
  • Loading branch information
VaibhavArora314 authored Aug 5, 2024
2 parents 56508dc + 44174d4 commit 330fa3c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/pages/Posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,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()
}
}}
/>
<button
onClick={handleSearch}
className="bg-blue-500 text-white px-4 py-2 rounded ml-2 hover:bg-blue-600 transition-colors duration-200"
Expand Down

0 comments on commit 330fa3c

Please sign in to comment.