2020-11-09 08:45:04 -08:00
import React , { Component } from 'react' ;
import { Link } from 'react-router-dom' ;
class SignInForm extends Component {
constructor ( ) {
super ( ) ;
this . state = {
email : '' ,
password : ''
} ;
this . handleChange = this . handleChange . bind ( this ) ;
this . handleSubmit = this . handleSubmit . bind ( this ) ;
}
handleChange ( e ) {
let target = e . target ;
let value = target . type === 'checkbox' ? target . checked : target . value ;
let name = target . name ;
this . setState ( {
[ name ] : value
} ) ;
}
handleSubmit ( e ) {
e . preventDefault ( ) ;
console . log ( 'The form was submitted with the following data:' ) ;
console . log ( this . state ) ;
}
render ( ) {
return (
< div className = "FormCenter" >
< form onSubmit = { this . handleSubmit } className = "FormFields" onSubmit = { this . handleSubmit } >
< div className = "FormField" >
< label className = "FormField__Label" htmlFor = "email" > E - Mail Address < / l a b e l >
< input type = "email" id = "email" className = "FormField__Input" placeholder = "Enter your email" name = "email" value = { this . state . email } onChange = { this . handleChange } / >
< / d i v >
< div className = "FormField" >
< label className = "FormField__Label" htmlFor = "password" > Password < / l a b e l >
< input type = "password" id = "password" className = "FormField__Input" placeholder = "Enter your password" name = "password" value = { this . state . password } onChange = { this . handleChange } / >
< / d i v >
< div className = "FormField" >
2020-11-23 08:49:49 -08:00
< button className = "FormField__Button mr-20" > Sign In < / b u t t o n > < L i n k e x a c t t o = " / s i g n - u p " c l a s s N a m e = " F o r m F i e l d _ _ L i n k " > N o t a m e m b e r ? < / L i n k >
2020-11-09 08:45:04 -08:00
< / d i v >
< / f o r m >
< / d i v >
) ;
}
}
export default SignInForm ;