From 22b301d295872cbe4bd104624a66a9801ca19ab1 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sat, 19 Dec 2020 03:12:10 +0200 Subject: [PATCH] PasswordField component --- src/components/common/inputs/PasswordField.js | 56 +++++++++++++++++++ src/constants/steps.js | 6 +- .../login/components/LoginComponent.js | 23 +++----- 3 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 src/components/common/inputs/PasswordField.js diff --git a/src/components/common/inputs/PasswordField.js b/src/components/common/inputs/PasswordField.js new file mode 100644 index 0000000..5ad0449 --- /dev/null +++ b/src/components/common/inputs/PasswordField.js @@ -0,0 +1,56 @@ +import React, { useState } from "react"; +import { + InputAdornment, + TextField, + makeStyles, + IconButton +} from "@material-ui/core"; +import { Visibility, VisibilityOff, LockOutlined } from "@material-ui/icons"; + +const useStyles = makeStyles(theme => ({ + margin: { + margin: theme.spacing(1) + } +})); + +const PasswordField = ({ label, ...rest }) => { + const [showPassword, setShowPassword] = useState(false); + const classes = useStyles(); + + const handleClickShowPassword = () => { + setShowPassword(!showPassword); + }; + + const handleMouseDownPassword = event => { + event.preventDefault(); + }; + + return ( + + + + ), + endAdornment: ( + + + {showPassword ? : } + + + ) + }} + /> + ); +}; + +export default PasswordField; diff --git a/src/constants/steps.js b/src/constants/steps.js index 9cf48a7..2a0a38b 100644 --- a/src/constants/steps.js +++ b/src/constants/steps.js @@ -1,4 +1,4 @@ -import { GroupAdd, VpnKey, Settings } from "@material-ui/icons"; +import { Router, VpnKey, Settings } from "@material-ui/icons"; const steps = [ { @@ -10,10 +10,10 @@ const steps = [ }, { id: 1, - title: "About", + title: "Network", route: "/about", disabled: false, - icon: + icon: }, { id: 2, diff --git a/src/features/login/components/LoginComponent.js b/src/features/login/components/LoginComponent.js index 491bdcc..593028a 100644 --- a/src/features/login/components/LoginComponent.js +++ b/src/features/login/components/LoginComponent.js @@ -1,11 +1,13 @@ import React from "react"; import { makeStyles } from "@material-ui/core/styles"; import { TextField, InputAdornment } from "@material-ui/core"; -import { AccountCircleOutlined, LockOutlined } from "@material-ui/icons"; +import { AccountCircleOutlined } from "@material-ui/icons"; +import PasswordField from "../../../components/common/inputs/PasswordField"; const useStyles = makeStyles(theme => ({ - margin: { - margin: theme.spacing(1) + field: { + margin: theme.spacing(1), + width: "20ch" } })); @@ -14,7 +16,7 @@ const LoginComponent = () => { return (
{ }} />
- - - - ) - }} - /> +
); };