Skip to content

Commit

Permalink
search added enter functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSychev2005 committed Nov 23, 2024
1 parent 560300b commit 9427424
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions FrontEnd/src/components/Header/Navbar/SearchBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ function SearchBox() {
}
};

const keyDownFunction = (e) => {
if (e.key === 'Enter' ) {
handleSearch();
}
};

const handleClear = () => {
setSearchTerm('');
};
Expand All @@ -28,6 +34,7 @@ function SearchBox() {
placeholder="Пошук"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
onKeyDown={keyDownFunction}
/>
{searchTerm && (
<Button
Expand Down

0 comments on commit 9427424

Please sign in to comment.