add login with enter key

This commit is contained in:
Anika Raemer 2025-10-12 08:43:27 +02:00
parent 97b0e5bdd3
commit a224397079
3 changed files with 16 additions and 1 deletions

View file

@ -3,12 +3,13 @@ import { useState } from "react";
type PasswordFieldProps = {
onPasswordChanged: (password : string) => void
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void
}
/**
* Password field component
*/
export default function PasswordField({onPasswordChanged} : PasswordFieldProps){
export default function PasswordField({onPasswordChanged, onKeyDown} : PasswordFieldProps){
const [showPassword, setShowPassword] = useState(false);
const [password, setPassword] = useState<string>("");
const iconSize = 20;
@ -25,6 +26,7 @@ export default function PasswordField({onPasswordChanged} : PasswordFieldProps){
placeholder="Passwort"
value={password}
onChange={(e) => changePassword(e.target.value)}
onKeyDown={onKeyDown}
/>
<button
type="button"