-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- implement user login functionality [Delivers #165305223]
- Loading branch information
1 parent
3f6c61b
commit 3c217cc
Showing
14 changed files
with
318 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,80 @@ | ||
.login h2 { | ||
color: blue; | ||
font-size: 18px; | ||
} | ||
.sign-in-page { | ||
h1 { | ||
text-align: center; | ||
margin-top: 2%; | ||
} | ||
|
||
.hidden { | ||
display: none; | ||
} | ||
|
||
.show { | ||
display: block; | ||
} | ||
|
||
.signin-form { | ||
display: inline-block; | ||
-moz-box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5); | ||
-webkit-box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5); | ||
box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5); | ||
padding: 70px 90px 90px 90px; | ||
width: 40%; | ||
height: 75%; | ||
margin: auto; | ||
display: flex; | ||
justify-content: space-between; | ||
flex-direction: column; | ||
margin-top: 2%; | ||
border-radius: 5px; | ||
} | ||
|
||
.separator { | ||
display: flex; | ||
align-items: center; | ||
&-line { | ||
height: 2px; | ||
background: #cecece; | ||
width: 48%; | ||
} | ||
&-text { | ||
background: transparent; | ||
border-radius: 50%; | ||
margin: 0 5px 0 5px; | ||
border: 2px solid #cecece; | ||
padding: 1%; | ||
} | ||
margin-bottom: 4%; | ||
margin-top: 4%; | ||
} | ||
|
||
.social { | ||
display: flex; | ||
justify-content: center; | ||
&-facebook { | ||
color: white; | ||
background-color: #3b5998; | ||
margin-right: 10%; | ||
} | ||
&-google { | ||
color: white; | ||
background-color: #db4437; | ||
} | ||
} | ||
|
||
.submit-btn { | ||
margin-bottom: 5%; | ||
background: #3472d6; | ||
color: white; | ||
padding: 4%; | ||
margin-top: 5%; | ||
} | ||
|
||
#email_error { | ||
display: none; | ||
.login { | ||
display: flex; | ||
align-items: center; | ||
margin-top: 10%; | ||
&-text { | ||
margin: -14px 5px 0 5px; | ||
} | ||
} | ||
} |
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
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,33 @@ | ||
import React from 'react'; | ||
import { NavLink, withRouter } from 'react-router-dom'; | ||
import { Menu } from 'semantic-ui-react'; | ||
import { connect } from 'react-redux'; | ||
import { logoutUser } from '../../redux/actions/loginActions'; | ||
|
||
|
||
class LoggedInLinks extends React.Component { | ||
handleLogout = () => { | ||
localStorage.clear(); | ||
const { logoutUser } = this.props; | ||
logoutUser(); | ||
this.props.history.push('/login'); | ||
}; | ||
|
||
render() { | ||
return <Menu.Item onClick={this.handleLogout} name="Logout" />; | ||
} | ||
} | ||
|
||
const mapStateToProps = state => ({ | ||
login: state.loginUser, | ||
error: state.LoginReducer.error, | ||
}); | ||
|
||
const mapDispatchToProps = () => ({ | ||
logoutUser, | ||
}); | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps(), | ||
)(withRouter(LoggedInLinks)); |
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,11 @@ | ||
import React from 'react'; | ||
import { NavLink } from 'react-router-dom'; | ||
import { Menu } from 'semantic-ui-react'; | ||
|
||
const LoggedOutLinks = () => ( | ||
<NavLink to="/login"> | ||
<Menu.Item name="login" /> | ||
</NavLink> | ||
); | ||
|
||
export default LoggedOutLinks; |
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,26 @@ | ||
import { toast } from 'react-toastify'; | ||
|
||
export const successToast = message => { | ||
toast.success(message, { | ||
position: toast.POSITION.TOP_CENTER, | ||
autoClose: 3000, | ||
hideProgressBar: true, | ||
pauseOnHover: true, | ||
}); | ||
}; | ||
|
||
export const errorToast = message => { | ||
toast.error(message, { | ||
position: toast.POSITION.TOP_CENTER, | ||
autoClose: 3000, | ||
hideProgressBar: true, | ||
pauseOnHover: true, | ||
}); | ||
}; | ||
|
||
export const isLoggedIn = () => { | ||
if (localStorage.getItem('token')) { | ||
return true; | ||
} | ||
return false; | ||
}; |
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
Oops, something went wrong.