Skip to content
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

Feature/gh 1733/legal updates #414

Merged
merged 17 commits into from Jul 18, 2019
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a2e4762
Begin implementation of legal consent checkbox
wlycdgr Jul 1, 2019
5a1f223
Add Public License and Privacy Policy links
wlycdgr Jul 1, 2019
466dd63
Remove old legal disclaimer from account creation form
wlycdgr Jul 1, 2019
84e44bb
Fix account creation form legal consent checkbox formatting
wlycdgr Jul 1, 2019
c00031f
Merge branch 'develop' into feature/GH-1733/legal-updates
wlycdgr Jul 3, 2019
5276732
Disable linting for legal terms checkbox label because linter is conf…
wlycdgr Jul 3, 2019
cbeafde
Merge branch 'develop' into feature/GH-1733/legal-updates
wlycdgr Jul 3, 2019
2f8662d
Block account creation in extension if legal consent checkbox is unch…
wlycdgr Jul 3, 2019
8ab9c4f
Remove placeholder legal consent string from messages json. Add place…
wlycdgr Jul 17, 2019
7799238
Swap in correct legal consent string for hub account creation form. A…
wlycdgr Jul 17, 2019
01f49c4
Implement legal consent checkbox state change handling
wlycdgr Jul 17, 2019
e8232ac
Improve and tidy legal consent checkbox UI in hub
wlycdgr Jul 17, 2019
da542fa
Update hub account creation form snapshots
wlycdgr Jul 17, 2019
30d725a
Resolve merge conflict in messages. Merge develop in.
wlycdgr Jul 17, 2019
b5a99d3
Reverse order of checkboxes in extension account creation form to mat…
wlycdgr Jul 17, 2019
87279fd
Merge branch 'develop' into feature/GH-1733/legal-updates
wlycdgr Jul 18, 2019
9eaa3ae
Change setState to use callback in hub account creation form checkbox…
wlycdgr Jul 18, 2019
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Implement legal consent checkbox state change handling

  • Loading branch information
wlycdgr committed Jul 17, 2019
commit 01f49c406c5c11e28c5f6a09e1da884b477e4b65
@@ -36,7 +36,8 @@ const CreateAccountView = (props) => {
legalConsentChecked,
promotionsChecked,
handleInputChange,
handleCheckboxChange,
handleLegalConsentCheckboxChange,
handlePromotionsCheckboxChange,
handleSubmit,
} = props;

@@ -168,21 +169,23 @@ const CreateAccountView = (props) => {
<div className="columns small-12 medium-5">
<div className="CreateAccountView__checkboxContainer CreateAccountView--marginBottom flex-container align-middle">
<ToggleCheckbox
name="legalConsentChecked"
checked={legalConsentChecked}
onChange={handleCheckboxChange}
onChange={handleLegalConsentCheckboxChange}
/>
<span
className="CreateAccountView__inputLabel clickable"
onClick={handleCheckboxChange}
onClick={handleLegalConsentCheckboxChange}
dangerouslySetInnerHTML={{ __html: t('create_account_form_legal_consent_checkbox_label') }}
/>
</div>
<div className="CreateAccountView__checkboxContainer CreateAccountView--marginBottom flex-container align-middle">
<ToggleCheckbox
name="promotionsChecked"
checked={promotionsChecked}
onChange={handleCheckboxChange}
onChange={handlePromotionsCheckboxChange}
/>
<span className="CreateAccountView__inputLabel clickable" onClick={handleCheckboxChange}>
<span className="CreateAccountView__inputLabel clickable" onClick={handlePromotionsCheckboxChange}>
{t('hub_create_account_checkbox_promotions')}
</span>
</div>
@@ -224,13 +227,14 @@ CreateAccountView.propTypes = {
confirmEmailError: PropTypes.bool.isRequired,
firstName: PropTypes.string.isRequired,
lastName: PropTypes.string.isRequired,
legalConsentChecked: PropTypes.bool.isRequired,
password: PropTypes.string.isRequired,
passwordInvalidError: PropTypes.bool.isRequired,
passwordLengthError: PropTypes.bool.isRequired,
legalConsentChecked: PropTypes.bool.isRequired,
promotionsChecked: PropTypes.bool.isRequired,
handleInputChange: PropTypes.func.isRequired,
handleCheckboxChange: PropTypes.func.isRequired,
handleLegalConsentCheckboxChange: PropTypes.func.isRequired,
handlePromotionsCheckboxChange: PropTypes.func.isRequired,
handleSubmit: PropTypes.func.isRequired,
};

@@ -37,10 +37,10 @@ class CreateAccountViewContainer extends Component {
confirmEmailError: false,
firstName: '',
lastName: '',
legalConsentChecked: false,
password: '',
passwordInvalidError: false,
passwordLengthError: false,
legalConsentChecked: false,
promotionsChecked: true,
validateInput: false,
};
@@ -94,9 +94,17 @@ class CreateAccountViewContainer extends Component {
}

/**
* Update input checkbox values by updating state.
* Update legal consetnt checkbox value by updating state
*/
_handleLegalConsentCheckboxChange = () => {
const legalConsentChecked = !this.state.legalConsentChecked;
this.setState({ legalConsentChecked });
This conversation was marked as resolved by christophertino

This comment has been minimized.

@christophertino

christophertino Jul 17, 2019
Member

Use callback on setState() rather than this.state. See react/no-access-state-in-setstate

This comment has been minimized.

@wlycdgr

wlycdgr Jul 18, 2019
Author Member

Done

}

/**
* Update promotions checkbox value by updating state
*/
_handleCheckboxChange = () => {
_handlePromotionsCheckboxChange = () => {
const promotionsChecked = !this.state.promotionsChecked;
this.setState({ promotionsChecked });
}
@@ -112,8 +120,8 @@ class CreateAccountViewContainer extends Component {
confirmEmail,
firstName,
lastName,
password,
legalConsentChecked,
password,
promotionsChecked
} = this.state;
const emailIsValid = email && validateEmail(email);
@@ -168,10 +176,10 @@ class CreateAccountViewContainer extends Component {
confirmEmailError,
firstName,
lastName,
legalConsentChecked,
password,
passwordInvalidError,
passwordLengthError,
legalConsentChecked,
promotionsChecked,
} = this.state;
const createAccountChildProps = {
@@ -181,13 +189,14 @@ class CreateAccountViewContainer extends Component {
confirmEmailError,
firstName,
lastName,
legalConsentChecked,
password,
passwordInvalidError,
passwordLengthError,
legalConsentChecked,
promotionsChecked,
handleInputChange: this._handleInputChange,
handleCheckboxChange: this._handleCheckboxChange,
handleLegalConsentCheckboxChange: this._handleLegalConsentCheckboxChange,
handlePromotionsCheckboxChange: this._handlePromotionsCheckboxChange,
handleSubmit: this._handleCreateAccountAttempt
};
const signedInChildProps = {
ProTip! Use n and p to navigate between commits in a pull request.