From 094a6c697ed070fdc57d0a70fb6f34a44f94b0ff Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 14 Apr 2024 21:18:19 +0100 Subject: [PATCH] add enter key to search for a player --- src/components/player-search.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/player-search.tsx b/src/components/player-search.tsx index 577ea90..52094e1 100644 --- a/src/components/player-search.tsx +++ b/src/components/player-search.tsx @@ -27,10 +27,21 @@ export default function PlayerSearch() { }); }; + const handleKeyDown = (e: any) => { + if (e.key === "Enter") { + handleSearch(); + } + }; + return (
- setPlayerId(e.target.value)} /> + setPlayerId(e.target.value)} + onKeyDown={handleKeyDown} + />