-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Milestone 54 / Convert Navbar to React #2306
Merged
Merged
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
4bd85f2
Navbar dropdowns conversion to React (#2230)
joykare 25c289a
Merge branch 'development' into brent-milestone-54
brent-hoover e4cbd77
Convert login views to React (#2250)
b4ea7a8
Merge branch 'development' into brent-milestone-54
brent-hoover 0ee4c7d
Merge branch 'development' into brent-milestone-54
brent-hoover 43b7dc7
[WIP]Main navbar container conversion to React (#2277)
joykare 3c6bcd8
Convert to react: Tag navigation (#2251)
impactmass be2f9dc
Merge branch 'development' into brent-milestone-54
brent-hoover 84b23f2
Init toggle visibility
impactmass 4b98e66
Close tags with overlay
impactmass 75d6c7f
Remove JQuery references(part 1)
fd3b4ab
Merge branch 'development' into brent-milestone-54
31f2037
Add router.go for tag click
impactmass b1154e4
Merge branch 'development' into brent-milestone-54
brent-hoover 4f7756e
Mobile fixes and remove blaze files
impactmass 351f913
Fix click on mobile
impactmass fed360a
Remove jquery
impactmass d758ed6
Merge branch 'development' into brent-milestone-54
impactmass 8458bb3
Remove jquery .closest
impactmass c090dcb
Merge branch 'development' into brent-milestone-54
impactmass 6192884
UI tagnav classes update
impactmass b3b1dae
Merge branch 'development' into brent-milestone-54
impactmass a9eeb4d
Fixes
impactmass 8e6e705
Fix undefined refs after merge with development
impactmass b36709c
Remove unused vars
mikemurray 3ceff6b
Editing should turn off on toggle
impactmass 9d787a8
Use Translation component over data-i18n
8649653
Fix Brand name glitch
joykare 24cdc7d
Merge branch 'development' into brent-milestone-54
impactmass 2070e71
Merge branch 'development' into brent-milestone-54
328a80d
Prefer standalone PropTypes import over React.PropTypes
fcd02ae
Inport i18next and Reaction in same line
8cefcb0
Space at end of self-closing tag
7759560
One-lining imports
b260dc0
Place ' ' inside span for less random-looking code
408a53a
Add comment about style
impactmass ffcaab6
Merge branch 'development' into brent-milestone-54
impactmass 3a09838
Use Divider component as separator
1fba3c8
Merge branch 'development' into brent-milestone-54
88dec41
Merge branch 'development' into brent-milestone-54
mikemurray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,3 @@ | ||
export LoginButtons from "./loginButtons"; | ||
export SignIn from "./signIn"; | ||
export SignUp from "./signUp"; |
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,76 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Button, Divider, Translation } from "/imports/plugins/core/ui/client/components"; | ||
|
||
class LoginButtons extends Component { | ||
static propTypes = { | ||
capitalizeName: PropTypes.func, | ||
currentView: PropTypes.string, | ||
loginServices: PropTypes.func, | ||
onSeparator: PropTypes.func, | ||
onSocialClick: PropTypes.func | ||
} | ||
|
||
renderLoginButtons() { | ||
const enabledServices = this.props.loginServices().filter((service) =>{ | ||
return service.enabled; | ||
}); | ||
|
||
return ( | ||
<div> | ||
{this.props.loginServices && | ||
enabledServices.map((service) => ( | ||
<Button | ||
key={service._id} | ||
className={`btn-block provider-${service.name}`} | ||
primary={true} | ||
bezelStyle="solid" | ||
type="button" | ||
data-provider={`${service.name}`} | ||
onClick={() => this.props.onSocialClick(service.name)} | ||
> | ||
<i className={`fa fa-${service.name}`} /> | ||
|
||
{this.props.currentView === "loginFormSignInView" && | ||
<span> | ||
<Translation defaultValue="Sign in with" i18nKey="accountsUI.signInWith" /> | ||
</span> | ||
} | ||
{this.props.currentView === "loginFormSignUpView" && | ||
<span> | ||
<Translation defaultValue="Sign up with" i18nKey="accountsUI.signUpWith" /> | ||
</span> | ||
} | ||
|
||
<span> | ||
| ||
<Translation defaultValue={this.props.capitalizeName(service.name)} i18nKey={`social.${service.name}`} /> | ||
</span> | ||
</Button> | ||
)) | ||
} | ||
</div> | ||
); | ||
} | ||
|
||
renderSeparator() { | ||
if (this.props.onSeparator()) { | ||
return ( | ||
<div className="loginForm-seperator"> | ||
<Divider id="auth-divider" label="or" i18nKeyLabel="accountsUI.or" /> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
{this.renderLoginButtons()} | ||
{this.renderSeparator()} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default LoginButtons; |
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,182 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import classnames from "classnames"; | ||
import { Button, TextField, Translation } from "/imports/plugins/core/ui/client/components"; | ||
|
||
class SignIn extends Component { | ||
static propTypes = { | ||
credentials: PropTypes.object, | ||
isLoading: PropTypes.bool, | ||
loginFormMessages: PropTypes.func, | ||
messages: PropTypes.object, | ||
onError: PropTypes.func, | ||
onForgotPasswordClick: PropTypes.func, | ||
onFormSubmit: PropTypes.func, | ||
onSignUpClick: PropTypes.func, | ||
uniqueId: PropTypes.string | ||
} | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
email: props.credentials.email, | ||
password: props.credentials.password | ||
}; | ||
|
||
this.handleFieldChange = this.handleFieldChange.bind(this); | ||
this.handleSubmit = this.handleSubmit.bind(this); | ||
} | ||
|
||
handleFieldChange = (event, value, field) => { | ||
this.setState({ | ||
[field]: value | ||
}); | ||
} | ||
|
||
handleSubmit = (event) => { | ||
if (this.props.onFormSubmit) { | ||
this.props.onFormSubmit(event, this.state.email, this.state.password); | ||
} | ||
} | ||
|
||
renderEmailErrors() { | ||
if (this.props.onError(this.props.messages.errors && this.props.messages.errors.email)) { | ||
return ( | ||
<span className="help-block"> | ||
<Translation | ||
defaultValue={this.props.messages.errors.email.reason} | ||
i18nKey={this.props.messages.errors.email.i18nKeyReason} | ||
/> | ||
</span> | ||
); | ||
} | ||
} | ||
|
||
renderPasswordErrors() { | ||
return ( | ||
<span className="help-block"> | ||
{this.props.onError(this.props.messages.errors && this.props.messages.errors.password) && | ||
this.props.messages.errors.password.map((error, i) => ( | ||
<Translation | ||
key={i} | ||
defaultValue={error.reason} | ||
i18nKey={error.i18nKeyReason} | ||
/> | ||
)) | ||
} | ||
</span> | ||
); | ||
} | ||
|
||
renderFormMessages() { | ||
if (this.props.loginFormMessages) { | ||
return ( | ||
<div> | ||
{this.props.loginFormMessages()} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
renderSpinnerOnWait() { | ||
if (this.props.isLoading === true) { | ||
return ( | ||
<div style={{ textAlign: "center" }}> | ||
<i className="fa fa-spinner fa-spin" /> | ||
</div> | ||
); | ||
} | ||
return ( | ||
<Button | ||
className="btn-block" | ||
primary={true} | ||
bezelStyle="solid" | ||
i18nKeyLabel="accountsUI.signIn" | ||
label="Sign In" | ||
type="submit" | ||
tabIndex="3" | ||
eventAction="submitSignInForm" | ||
/> | ||
); | ||
} | ||
|
||
render() { | ||
const emailClasses = classnames({ | ||
"form-group": true, | ||
"form-group-email": true, | ||
"has-error has-feedback": this.props.onError(this.props.messages.errors && this.props.messages.errors.email) | ||
}); | ||
|
||
const passwordClasses = classnames({ | ||
"form-group": true, | ||
"has-error has-feedback": this.props.onError(this.props.messages.errors && this.props.messages.errors.password) | ||
}); | ||
return ( | ||
<div> | ||
<div className="loginForm-title"> | ||
<h2> | ||
<Translation defaultValue="Sign In" i18nKey="accountsUI.signIn" /> | ||
</h2> | ||
</div> | ||
|
||
<form className="login-form" onSubmit={this.handleSubmit} noValidate> | ||
|
||
{this.renderFormMessages()} | ||
|
||
<div className={emailClasses}> | ||
<TextField | ||
i18nKeyLabel="accountsUI.emailAddress" | ||
label="Email" | ||
name="email" | ||
type="email" | ||
tabIndex="1" | ||
id={`email-${this.props.uniqueId}`} | ||
value={this.state.email} | ||
onChange={this.handleFieldChange} | ||
/> | ||
{this.renderEmailErrors()} | ||
</div> | ||
|
||
<div className={passwordClasses}> | ||
<TextField | ||
i18nKeyLabel="accountsUI.password" | ||
label="Password" | ||
name="password" | ||
type="password" | ||
tabIndex="2" | ||
id={`password-${this.props.uniqueId}`} | ||
value={this.state.password} | ||
onChange={this.handleFieldChange} | ||
/> | ||
{this.renderPasswordErrors()} | ||
</div> | ||
|
||
<div className="form-group"> | ||
{this.renderSpinnerOnWait()} | ||
</div> | ||
|
||
<div className="form-group flex flex-justify-spaceBetween"> | ||
<a | ||
href="#" | ||
tabIndex="4" | ||
onClick={this.props.onForgotPasswordClick} | ||
> | ||
<Translation defaultValue="Reset Password" i18nKey="accountsUI.forgotPassword" /> | ||
</a> | ||
<a | ||
href="#" | ||
tabIndex="5" | ||
onClick={this.props.onSignUpClick} | ||
> | ||
<Translation defaultValue="Register" i18nKey="accountsUI.signUp" /> | ||
</a> | ||
</div> | ||
|
||
</form> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default SignIn; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a
<Divider />
component, would it work for what you are trying to do here?https://styleguide.reactioncommerce.com/reaction/guide/divider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No @kieckhafer, it wouldn't. This renders the word
or
between the social login buttons and the auth forms.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can render words as well with
<Divider label="or" />
@rymorgan what do you think, this is more a design question than anything else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kieha I agree with @kieckhafer it should be the divider component with 'or' as the label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Last thing is the Avatar component, but it seems like that PR won't be pulled in yet so i'll create a new issue for it and approve this.