mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-09 11:14:29 +02:00
Upgrades biome to 1.6.1, and updates husky pre-commit hook. Most changes here are making type imports explicit.
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import {
|
|
IconButton,
|
|
InputAdornment,
|
|
TextField,
|
|
type TextFieldProps,
|
|
} from '@mui/material';
|
|
import Visibility from '@mui/icons-material/Visibility';
|
|
import VisibilityOff from '@mui/icons-material/VisibilityOff';
|
|
import type React from 'react';
|
|
import { useState, type VFC } from 'react';
|
|
|
|
const PasswordField: VFC<TextFieldProps> = ({ ...rest }) => {
|
|
const [showPassword, setShowPassword] = useState(false);
|
|
|
|
const handleClickShowPassword = () => {
|
|
setShowPassword(!showPassword);
|
|
};
|
|
|
|
const handleMouseDownPassword = (
|
|
e: React.MouseEvent<HTMLButtonElement>,
|
|
) => {
|
|
e.preventDefault();
|
|
};
|
|
|
|
const IconComponent = showPassword ? Visibility : VisibilityOff;
|
|
const iconTitle = 'Toggle password visibility';
|
|
|
|
return (
|
|
<TextField
|
|
variant='outlined'
|
|
size='small'
|
|
type={showPassword ? 'text' : 'password'}
|
|
InputProps={{
|
|
style: {
|
|
paddingRight: '0px',
|
|
},
|
|
endAdornment: (
|
|
<InputAdornment position='end'>
|
|
<IconButton
|
|
onClick={handleClickShowPassword}
|
|
onMouseDown={handleMouseDownPassword}
|
|
size='large'
|
|
>
|
|
<IconComponent titleAccess={iconTitle} />
|
|
</IconButton>
|
|
</InputAdornment>
|
|
),
|
|
}}
|
|
{...rest}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default PasswordField;
|