diff --git a/src/routes/Intro/ConsentCheckbox.js b/src/routes/Intro/ConsentCheckbox/ConsentCheckbox.js similarity index 76% rename from src/routes/Intro/ConsentCheckbox.js rename to src/routes/Intro/ConsentCheckbox/ConsentCheckbox.js index ad65529bf..f818afa1e 100644 --- a/src/routes/Intro/ConsentCheckbox.js +++ b/src/routes/Intro/ConsentCheckbox/ConsentCheckbox.js @@ -3,9 +3,9 @@ const PropTypes = require('prop-types'); const classnames = require('classnames'); const { Input } = require('stremio-navigation'); const { Checkbox } = require('stremio/common'); -const styles = require('./styles'); +require('./styles'); -const ConsentCheckbox = React.forwardRef(({ checked, label, link, href, toggle }, ref) => { +const ConsentCheckbox = React.forwardRef(({ className, checked, label, link, href, toggle }, ref) => { const checkboxOnClick = React.useCallback((event) => { if (!event.nativeEvent.handled && typeof toggle === 'function') { toggle(event); @@ -15,13 +15,13 @@ const ConsentCheckbox = React.forwardRef(({ checked, label, link, href, toggle } event.nativeEvent.handled = true; }, []); return ( - -
+ +
{label} { typeof link === 'string' && typeof href === 'string' ? { - if (this.state.selectedForm === FORMS.LOGIN) { - this.loginWithEmail(); - } else { + if (this.state.selectedForm === SIGNUP_FORM) { this.confirmPasswordRef.current.focus(); + } else { + this.loginWithEmail(); } } @@ -100,19 +98,19 @@ class Intro extends React.Component { this.termsRef.current.focus(); } - toggleTerms = () => { + toggleTermsAccepted = () => { this.setState(({ termsAccepted }) => ({ termsAccepted: !termsAccepted })); } - togglePrivacyPolicy = () => { + togglePrivacyPolicyAccepted = () => { this.setState(({ privacyPolicyAccepted }) => ({ privacyPolicyAccepted: !privacyPolicyAccepted })); } - toggleMarketing = () => { + toggleMarketingAccepted = () => { this.setState(({ marketingAccepted }) => ({ marketingAccepted: !marketingAccepted })); @@ -173,22 +171,27 @@ class Intro extends React.Component { return; } + if (!this.state.privacyPolicyAccepted) { + this.setState({ error: 'You must accept the Privacy Policy' }); + return; + } + this.setState({ error: '' }); alert('TODO: Guest login'); } render() { return ( -
-
- - -
Continue with Facebook
+
+
+ + +
Continue with Facebook
-
We won't post anything on your behalf
+
We won't post anything on your behalf
{ - this.state.selectedForm === FORMS.LOGIN ? -
- Forgot password? -
- : + this.state.selectedForm === SIGNUP_FORM ? + : +
+ Forgot password? +
} { this.state.error.length > 0 ? -
{this.state.error}
+
{this.state.error}
: null } - -
{this.state.selectedForm === FORMS.LOGIN ? 'LOG IN' : 'SING UP'}
+ +
{this.state.selectedForm === SIGNUP_FORM ? 'SING UP' : 'LOG IN'}
{ - this.state.selectedForm === FORMS.SIGN_UP ? - -
GUEST LOGIN
+ this.state.selectedForm === SIGNUP_FORM ? + +
GUEST LOGIN
: null } - -
{this.state.selectedForm === FORMS.SIGN_UP ? 'LOG IN' : 'SING UP WITH EMAIL'}
+ +
{this.state.selectedForm === SIGNUP_FORM ? 'LOG IN' : 'SING UP WITH EMAIL'}
diff --git a/src/routes/Intro/styles.less b/src/routes/Intro/styles.less index bb47a28f8..5b83aea71 100644 --- a/src/routes/Intro/styles.less +++ b/src/routes/Intro/styles.less @@ -121,48 +121,8 @@ } .consent-checkbox { - --icon-size: 1.2rem; - --icon-color: var(--color-surface); - --icon-background-color: transparent; - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; margin: 1rem 0; padding: 0.5rem 0.3rem; - cursor: pointer; - - .label { - flex: 1; - margin-left: 0.5rem; - color: var(--color-surface); - - .link { - color: var(--color-surfacelight); - - &:hover { - text-decoration: underline; - } - } - } - - &:global(.checked) { - --icon-color: var(--color-surfacelight); - --icon-background-color: var(--color-primary); - } - - &:focus-within, &:hover { - --icon-color: var(--color-surfacelighter); - background-color: var(--color-surfacedarker60); - - .label { - color: var(--color-surfacelighter); - - .link { - color: var(--color-surfacelighter); - } - } - } } .error-message {