({label, ...props})
| 93 | } |
| 94 | |
| 95 | export function PasswordField({label, ...props}) { |
| 96 | const [show, setShow] = useState(false); |
| 97 | return ( |
| 98 | <TextField |
| 99 | fullWidth |
| 100 | size='small' |
| 101 | variant='outlined' |
| 102 | type={show ? 'text' : 'password'} |
| 103 | label={label} |
| 104 | {...props} |
| 105 | InputProps={{ |
| 106 | endAdornment: ( |
| 107 | <InputAdornment position='end'> |
| 108 | <IconButton size='small' edge='end' aria-label={show ? '隐藏密码' : '显示密码'} onClick={() => setShow((s) => !s)}> |
| 109 | {show ? <VisibilityOff fontSize='small'/> : <Visibility fontSize='small'/>} |
| 110 | </IconButton> |
| 111 | </InputAdornment> |
| 112 | ), |
| 113 | }} |
| 114 | /> |
| 115 | ); |
| 116 | } |
nothing calls this directly
no outgoing calls
no test coverage detected