forked from mxstbr/login-flow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mxstbr#30 from areiterer/master
Display error messages with separate component
- Loading branch information
Showing
9 changed files
with
118 additions
and
89 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.error-wrapper { | ||
display: flex; | ||
justify-content: center; | ||
max-width: calc(100% - 2em); | ||
margin: 0 auto; | ||
margin-bottom: 1em; | ||
} | ||
|
||
.error { | ||
display: inline-block; | ||
background-color: $error-color; | ||
color: white; | ||
margin: 0; | ||
padding: 0.5em 1em; | ||
font-size: 0.8em; | ||
font-family: $text-font-stack; | ||
user-select: none; | ||
} |
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,24 @@ | ||
import React, { PropTypes } from 'react'; | ||
import { connect } from 'react-redux'; | ||
|
||
let ErrorMessage = (props) => { | ||
return ( | ||
props.errorMessage ? | ||
<div className="error-wrapper"> | ||
<p className="error">{props.errorMessage}</p> | ||
</div> | ||
:<div></div> | ||
); | ||
}; | ||
|
||
ErrorMessage.propTypes = { | ||
errorMessage: PropTypes.string | ||
}; | ||
|
||
const mapStateToProps = (state) => ({ | ||
errorMessage: state.errorMessage | ||
}); | ||
|
||
ErrorMessage = connect(mapStateToProps)(ErrorMessage); | ||
|
||
export default ErrorMessage; |
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,12 @@ | ||
/* | ||
* MessageConstants | ||
* These are the variables that contain the text which is displayed on certain errors | ||
* | ||
* Follow this format: | ||
* export const YOUR_CONSTANT = 'Your message text'; | ||
*/ | ||
export const FIELD_MISSING = 'Please fill out the entire form.'; | ||
export const WRONG_PASSWORD = 'Wrong password.'; | ||
export const USER_NOT_FOUND = 'This username does not exist.'; | ||
export const USERNAME_TAKEN = 'Sorry, but this username is already taken'; | ||
export const GENERAL_ERROR = 'Something went wrong, please try again'; |
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