Login field component
This commit is contained in:
parent
94f5d3f85b
commit
02332c284b
1 changed files with 54 additions and 0 deletions
54
frontend/src/Components/LoginField.tsx
Normal file
54
frontend/src/Components/LoginField.tsx
Normal file
|
@ -0,0 +1,54 @@
|
|||
import { Dispatch, FormEventHandler, SetStateAction } from "react";
|
||||
import Button from "./Button";
|
||||
import InputField from "./InputField";
|
||||
|
||||
/**
|
||||
* A login field complete with input fields
|
||||
* and a button for submitting the information
|
||||
* @param props - Settings
|
||||
* @returns {JSX.Element} A login component
|
||||
* @example
|
||||
* <Login
|
||||
* handleSubmit={handleSubmit}
|
||||
* setUsername={setUsername}
|
||||
* setPassword={setPassword}
|
||||
* username={username}
|
||||
* password={password}
|
||||
* />
|
||||
*/
|
||||
function Login(props: {
|
||||
handleSubmit: FormEventHandler<HTMLFormElement>;
|
||||
setUsername: Dispatch<SetStateAction<string>>;
|
||||
setPassword: Dispatch<SetStateAction<string>>;
|
||||
username: string;
|
||||
password: string;
|
||||
}): JSX.Element {
|
||||
return (
|
||||
<form className="flex flex-col items-center" onSubmit={props.handleSubmit}>
|
||||
<InputField
|
||||
type="text"
|
||||
label="Username"
|
||||
onChange={(e) => {
|
||||
props.setUsername(e.target.value);
|
||||
}}
|
||||
value={props.username}
|
||||
/>
|
||||
<InputField
|
||||
type="password"
|
||||
label="Password"
|
||||
onChange={(e) => {
|
||||
props.setPassword(e.target.value);
|
||||
}}
|
||||
value={props.password}
|
||||
/>
|
||||
<Button
|
||||
text="Login"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export default Login;
|
Loading…
Reference in a new issue