@@ -2,6 +2,10 @@ import { Formik, Form, Field} from 'formik';
2
2
import { register } from '../../redux/auth/operations' ;
3
3
import { useDispatch } from 'react-redux' ;
4
4
import css from "./RegistrationForm.module.css"
5
+ import svg from "../../img/icons.svg" ;
6
+ import { useState } from 'react' ;
7
+
8
+
5
9
6
10
7
11
export const RegistrationForm = ( ) => {
@@ -13,6 +17,13 @@ export const RegistrationForm = () => {
13
17
actions . resetForm ( ) ;
14
18
} ;
15
19
20
+ const [ showPassword , setShowPassword ] = useState ( false ) ;
21
+
22
+ const togglePasswordVisibility = ( event ) => {
23
+ event . preventDefault ( ) ;
24
+ setShowPassword ( ! showPassword ) ;
25
+ } ;
26
+
16
27
17
28
return (
18
29
< div >
@@ -27,16 +38,28 @@ export const RegistrationForm = () => {
27
38
onSubmit = { handleSubmit }
28
39
>
29
40
< Form className = { css . form } >
30
- < label > Enter your name</ label >
31
- < Field type = "name" name = "name" />
32
-
33
- < label > Enter your Email</ label >
34
- < Field type = "email" name = "email" />
35
-
36
- < label > Create a password</ label >
37
- < Field type = "password" name = "password" />
41
+ < label htmlFor = "name" />
42
+ < Field type = "name" name = "name" placeholder = "Enter your name" className = { css . input } />
43
+ < label htmlFor = "email" />
44
+ < Field type = "email" name = "email" placeholder = "Enter your email" className = { css . input } />
45
+ < label htmlFor = "password" />
46
+ < div >
47
+ < Field
48
+ type = { showPassword ? "text" : "password" }
49
+ name = "password"
50
+ className = { css . input }
51
+ placeholder = "Create a password"
52
+ />
53
+ < button type = "button " className = { css . eye } onClick = { togglePasswordVisibility } >
54
+ { /* <svg width="18" height="18" stroke="currentColor">
55
+ <use
56
+ href={`${svg}${showPassword ? "#eye-slash-icon" : "#eye-icon"}`}
57
+ ></use>
58
+ </svg> */ }
59
+ </ button >
60
+ </ div >
38
61
39
- < button type = "submit" > Register Now</ button >
62
+ < button type = "submit" className = { css . button } > Register Now</ button >
40
63
</ Form >
41
64
</ Formik >
42
65
</ div >
0 commit comments