Clean up css
This commit is contained in:
parent
5a4e04a47c
commit
c866c01dfe
17 changed files with 214 additions and 250 deletions
|
|
@ -1,41 +1,41 @@
|
|||
import { Eye, EyeOff } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { defaultIconSize } from "./SvgIcon";
|
||||
import {Eye, EyeOff} from "lucide-react";
|
||||
import {useState} from "react";
|
||||
import {defaultIconSize} from "./SvgIcon";
|
||||
|
||||
type PasswordFieldProps = {
|
||||
onPasswordChanged: (password : string) => void
|
||||
onPasswordChanged: (password: string) => void
|
||||
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* Password field component
|
||||
*/
|
||||
export default function PasswordField({onPasswordChanged, onKeyDown} : PasswordFieldProps){
|
||||
export default function PasswordField({onPasswordChanged, onKeyDown}: PasswordFieldProps) {
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [password, setPassword] = useState<string>("");
|
||||
|
||||
const changePassword = (password : string) => {
|
||||
|
||||
const changePassword = (password: string) => {
|
||||
setPassword(password);
|
||||
onPasswordChanged(password)
|
||||
}
|
||||
return (
|
||||
<div className="relative">
|
||||
<input
|
||||
className="input-field pr-10"
|
||||
type={showPassword ? "text" : "password"}
|
||||
placeholder="Passwort"
|
||||
value={password}
|
||||
onChange={(e) => changePassword(e.target.value)}
|
||||
onKeyDown={onKeyDown}
|
||||
className="pr-10"
|
||||
type={showPassword ? "text" : "password"}
|
||||
placeholder="Passwort"
|
||||
value={password}
|
||||
onChange={(e) => changePassword(e.target.value)}
|
||||
onKeyDown={onKeyDown}
|
||||
/>
|
||||
{/* Add a little eye icon to the right for showing password */}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowPassword(!showPassword)}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700"
|
||||
aria-label={showPassword ? "Passwort ausblenden" : "Passwort anzeigen"}
|
||||
type="button"
|
||||
onClick={() => setShowPassword(!showPassword)}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700"
|
||||
aria-label={showPassword ? "Passwort ausblenden" : "Passwort anzeigen"}
|
||||
>
|
||||
{showPassword ? <EyeOff size={defaultIconSize} /> : <Eye size={defaultIconSize} />}
|
||||
{showPassword ? <EyeOff size={defaultIconSize}/> : <Eye size={defaultIconSize}/>}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue