Skip to content

Commit

Permalink
Listen for key down on Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-karlsson committed Mar 21, 2024
1 parent 696f1be commit 66ab3b5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion client/src/components/Setup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ function Setup() {
alignItems: "center",
};

function enterCouncil() {
console.log("Entering council...");
}

function handleKeyDown(e) {
if (e.key === "Enter") {
enterCouncil();
}
}

return (
<div style={welcomeStyle}>
<div>
Expand All @@ -41,6 +51,7 @@ function Setup() {
className="text-input"
rows="2"
cols="30"
onKeyDown={handleKeyDown}
></textarea>
</div>
<div>
Expand All @@ -54,7 +65,12 @@ function Setup() {
))}
</div>
</div>
<button className="outline-button">Enter</button>
<button
className="outline-button"
onClick={enterCouncil}
>
Enter
</button>
</div>
);
}
Expand Down

0 comments on commit 66ab3b5

Please sign in to comment.