Created the LoginFields.jsx

This commit is contained in:
Mathias Wagner 2023-07-30 19:06:03 +02:00
parent 8caf95c06e
commit 94d58b13fd
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -0,0 +1,26 @@
import {IconButton, InputAdornment, TextField} from "@mui/material";
import {Key, Person, Visibility, VisibilityOff} from "@mui/icons-material";
import {useState} from "react";
export const LoginFields = ({username, setUsername, password, setPassword}) => {
const [passwordShown, setPasswordShown] = useState(false);
return (
<>
<TextField label="Benutzername" variant="outlined" sx={{width: "20rem"}} type="text"
placeholder="Benutzername" autoComplete="username" value={username}
onChange={(e) => setUsername(e.target.value)}
InputProps={{startAdornment: <InputAdornment position="start"><Person/></InputAdornment>}}/>
<TextField label="Passwort" variant="outlined" sx={{width: "20rem"}} placeholder="Passwort"
InputProps={{
startAdornment: <InputAdornment position="start"><Key/></InputAdornment>,
endAdornment: <InputAdornment position="end"
onClick={() => setPasswordShown(!passwordShown)}>
<IconButton>{passwordShown ? <VisibilityOff/> : <Visibility/>}</IconButton>
</InputAdornment>
}} type={passwordShown ? "text" : "password"} autoComplete="current-password"
value={password} onChange={(e) => setPassword(e.target.value)}/>
</>
)
}