Skip to content

🪟🧪 [Experiment] Move OAuth to top of signup page #18899

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

Merged
merged 3 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export interface Experiments {
"authPage.oauth.google.signUpPage": boolean;
"authPage.oauth.github.signUpPage": boolean;
"onboarding.speedyConnection": boolean;
"authPage.oauth.position": "top" | "bottom";
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { BottomBlock, FieldItem, Form } from "packages/cloud/views/auth/componen
import { FormTitle } from "packages/cloud/views/auth/components/FormTitle";

import { OAuthLogin } from "../OAuthLogin";
import { Separator } from "../SignupPage/components/Separator";
import { Disclaimer } from "../SignupPage/components/SignupForm";
import styles from "./LoginPage.module.scss";

Expand Down Expand Up @@ -112,6 +113,8 @@ const LoginPage: React.FC = () => {
</Form>
)}
</Formik>

<Separator />
<OAuthLogin />
<Disclaimer />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
@use "../../../../../scss/variables" as vars;
@use "../../../../../scss/colors";

.separator {
display: flex;
margin: vars.$spacing-xl 0;
font-size: 16px;
text-align: center;
font-weight: bold;
color: colors.$grey-800;
text-transform: uppercase;

&::before,
&::after {
content: "";
flex: 1 1;
border-bottom: 1px solid colors.$grey-300;
margin: auto;
}

&::before {
margin-right: vars.$spacing-md;
}

&::after {
margin-left: vars.$spacing-md;
}
}

.buttons {
display: grid;
grid-template-columns: 1fr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ export const OAuthLogin: React.FC<OAuthLoginProps> = ({ isSignUpPage }) => {

return (
<div>
<div className={styles.separator}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted as <Separator />

<FormattedMessage id="login.oauth.or" />
</div>
{isLoading && (
<div className={styles.spinner}>
<Spinner />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
@use "../../../../../scss/colors";
@use "../../../../../scss/variables";

.container {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding styles for Signup Page Container, as it should be responsible of positioning elements on it.

display: flex;
flex-direction: column;
gap: variables.$spacing-xl;
}

.title {
width: 250px;
margin-bottom: variables.$spacing-md;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { HeadTitle } from "components/common/HeadTitle";
import { Heading } from "components/ui/Heading";

import { PageTrackingCodes, useTrackPage } from "hooks/services/Analytics";
import { useExperiment } from "hooks/services/Experiment";

import { OAuthLogin } from "../OAuthLogin";
import { Separator } from "./components/Separator";
import { Disclaimer, SignupForm } from "./components/SignupForm";
import SpecialBlock from "./components/SpecialBlock";
import styles from "./SignupPage.module.scss";
Expand All @@ -17,8 +19,10 @@ interface SignupPageProps {

const SignupPage: React.FC<SignupPageProps> = ({ highlightStyle }) => {
useTrackPage(PageTrackingCodes.SIGNUP);
const oAuthPosition = useExperiment("authPage.oauth.position", "bottom");

return (
<div>
<div className={styles.container}>
<HeadTitle titles={[{ id: "login.signup" }]} />
<Heading as="h1" size="xl" className={styles.title}>
<FormattedMessage
Expand All @@ -33,8 +37,19 @@ const SignupPage: React.FC<SignupPageProps> = ({ highlightStyle }) => {
/>
</Heading>
<SpecialBlock />
{oAuthPosition === "top" && (
<>
<OAuthLogin isSignUpPage />
<Separator />
</>
)}
<SignupForm />
<OAuthLogin isSignUpPage />
{oAuthPosition === "bottom" && (
<>
<Separator />
<OAuthLogin isSignUpPage />
</>
)}
<Disclaimer />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@use "../../../../../../scss/variables" as vars;
@use "../../../../../../scss/colors";

.separator {
display: flex;
padding: vars.$spacing-md 0;
font-size: 16px;
text-align: center;
font-weight: bold;
color: colors.$grey-800;
text-transform: uppercase;

&::before,
&::after {
content: "";
flex: 1 1;
border-bottom: 1px solid colors.$grey-300;
margin: auto;
}

&::before {
margin-right: vars.$spacing-md;
}

&::after {
margin-left: vars.$spacing-md;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { FormattedMessage } from "react-intl";

import styles from "./Separator.module.scss";
export const Separator: React.FC = () => {
return (
<div className={styles.separator}>
<FormattedMessage id="login.oauth.or" />
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, FieldProps, Formik } from "formik";
import { Field, FieldProps, Formik, Form } from "formik";
import React, { useMemo } from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { useSearchParams } from "react-router-dom";
Expand All @@ -15,7 +15,7 @@ import { isGdprCountry } from "utils/dataPrivacy";
import { links } from "utils/links";

import CheckBoxControl from "../../components/CheckBoxControl";
import { BottomBlock, FieldItem, Form, RowFieldItem } from "../../components/FormComponents";
import { BottomBlock, FieldItem, RowFieldItem } from "../../components/FormComponents";
import styles from "./SignupForm.module.scss";

interface FormValues {
Expand Down