-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added 'password' input type in template. * added field with type password for inputs --------- Co-authored-by: Vadim Zabolotniy <[email protected]> Co-authored-by: ATomkivEX <[email protected]>
- Loading branch information
1 parent
7ead29e
commit e9af60a
Showing
6 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
frontend/src/app/main/applications/TemplateInputs/TypePassword.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Visibility, VisibilityOff } from '@mui/icons-material'; | ||
import { FormHelperText } from '@mui/material'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import InputAdornment from '@mui/material/InputAdornment'; | ||
import TextField from '@mui/material/TextField'; | ||
import { useState } from 'react'; | ||
|
||
const TypePassword = ({ item, onChangeInputs }) => { | ||
const [showPassword, setShowPassword] = useState(false); | ||
const handleClickShowPassword = () => setShowPassword(!showPassword); | ||
const handleMouseDownPassword = () => setShowPassword(!showPassword); | ||
|
||
return ( | ||
<FormControl fullWidth margin='normal'> | ||
<TextField | ||
type={showPassword ? 'text' : 'password'} | ||
name='password' | ||
required | ||
label={item.label} | ||
value={item.default} | ||
onChange={(e) => onChangeInputs(e, item)} | ||
InputProps={{ | ||
endAdornment: ( | ||
<InputAdornment position='end'> | ||
<IconButton | ||
aria-label='toggle password visibility' | ||
onClick={handleClickShowPassword} | ||
onMouseDown={handleMouseDownPassword} | ||
> | ||
{showPassword ? <Visibility /> : <VisibilityOff />} | ||
</IconButton> | ||
</InputAdornment> | ||
), | ||
}} | ||
/> | ||
<FormHelperText>{item?.description}</FormHelperText> | ||
</FormControl> | ||
); | ||
}; | ||
|
||
export default TypePassword; |
12 changes: 11 additions & 1 deletion
12
.../app/main/templates/TemplateModal/TemplateBuilder/InputsBuilder/InputFields/InputTypes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters