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

feat(clerk-js): Retheme Sign Up #2376

Merged
merged 4 commits into from
Dec 15, 2023
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
2 changes: 2 additions & 0 deletions .changeset/odd-eels-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
19 changes: 11 additions & 8 deletions packages/clerk-js/src/ui/common/EmailLinkStatusCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ export const EmailLinkStatusCard = (props: EmailLinkStatusCardProps) => {
return (
<Flow.Part part='emailLinkStatus'>
<Card.Root>
<Card.Alert>{card.error}</Card.Alert>
<Header.Root>
<Header.Title localizationKey={props.title} />
<Header.Subtitle localizationKey={props.subtitle} />
</Header.Root>
<Col elementDescriptor={descriptors.main}>
<StatusRow status={props.status} />
</Col>
<Card.Content>
<Card.Alert>{card.error}</Card.Alert>
<Header.Root>
<Header.Title localizationKey={props.title} />
<Header.Subtitle localizationKey={props.subtitle} />
</Header.Root>
<Col elementDescriptor={descriptors.main}>
<StatusRow status={props.status} />
</Col>
</Card.Content>
<Card.Footer />
</Card.Root>
</Flow.Part>
);
Expand Down
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/common/SSOCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const SSOCallbackCard = (props: HandleOAuthCallbackParams | HandleSamlCal
<Card.Alert>{card.error}</Card.Alert>
<LoadingCardContainer />
</Card.Content>
<Card.Footer />
</Card.Root>
</Flow.Part>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,57 @@ const _SignInAccountSwitcher = () => {
return (
<Flow.Part part='accountSwitcher'>
<Card.Root>
<Card.Alert>{card.error}</Card.Alert>
<Header.Root>
<Header.Title>Signed out</Header.Title>
<Header.Subtitle>Select account to continue to {applicationName}</Header.Subtitle>
</Header.Root>
<Col
elementDescriptor={descriptors.main}
gap={8}
>
<Col>
{activeSessions.map(s => (
<PreviewButton
key={s.id}
onClick={handleSessionClicked(s)}
sx={theme => ({ height: theme.sizes.$16, justifyContent: 'flex-start' })}
<Card.Content>
<Card.Alert>{card.error}</Card.Alert>
<Header.Root>
<Header.Title>Signed out</Header.Title>
<Header.Subtitle>Select account to continue to {applicationName}</Header.Subtitle>
</Header.Root>
<Col
elementDescriptor={descriptors.main}
gap={8}
>
<Col>
{activeSessions.map(s => (
<PreviewButton
key={s.id}
onClick={handleSessionClicked(s)}
sx={theme => ({ height: theme.sizes.$16, justifyContent: 'flex-start' })}
>
<UserPreview user={s.user} />
</PreviewButton>
))}
</Col>
<Col gap={2}>
<ArrowBlockButton
isDisabled={card.isLoading}
leftIcon={
<Icon
size='sm'
icon={Plus}
sx={theme => ({ color: theme.colors.$blackAlpha500 })}
/>
}
onClick={handleAddAccountClicked}
>
<UserPreview user={s.user} />
</PreviewButton>
))}
</Col>
<Col gap={2}>
<ArrowBlockButton
isDisabled={card.isLoading}
leftIcon={
<Icon
size='sm'
icon={Plus}
sx={theme => ({ color: theme.colors.$blackAlpha500 })}
/>
}
onClick={handleAddAccountClicked}
>
Add account
</ArrowBlockButton>
<ArrowBlockButton
isDisabled={card.isLoading}
leftIcon={
<Icon
icon={SignOutDouble}
sx={theme => ({ color: theme.colors.$blackAlpha500 })}
/>
}
onClick={handleSignOutAllClicked}
>
Sign out of all accounts
</ArrowBlockButton>
Add account
</ArrowBlockButton>
<ArrowBlockButton
isDisabled={card.isLoading}
leftIcon={
<Icon
icon={SignOutDouble}
sx={theme => ({ color: theme.colors.$blackAlpha500 })}
/>
}
onClick={handleSignOutAllClicked}
>
Sign out of all accounts
</ArrowBlockButton>
</Col>
</Col>
</Col>
</Card.Content>
<Card.Footer />
</Card.Root>
</Flow.Part>
);
Expand Down
74 changes: 39 additions & 35 deletions packages/clerk-js/src/ui/components/SignUp/SignUpContinue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,42 +160,46 @@ function _SignUpContinue() {
return (
<Flow.Part part='complete'>
<Card.Root>
<Card.Alert>{card.error}</Card.Alert>
<Header.Root>
<Header.Title localizationKey={localizationKeys('signUp.continue.title')} />
<Header.Subtitle localizationKey={localizationKeys('signUp.continue.subtitle')} />
</Header.Root>
<Flex
direction='col'
elementDescriptor={descriptors.main}
gap={8}
>
<SocialButtonsReversibleContainerWithDivider>
{(showOauthProviders || showWeb3Providers) && (
<SignUpSocialButtons
enableOAuthProviders={showOauthProviders}
enableWeb3Providers={showWeb3Providers}
<Card.Content>
<Card.Alert>{card.error}</Card.Alert>
<Header.Root>
<Header.Title localizationKey={localizationKeys('signUp.continue.title')} />
<Header.Subtitle localizationKey={localizationKeys('signUp.continue.subtitle')} />
</Header.Root>
<Flex
direction='col'
elementDescriptor={descriptors.main}
gap={8}
>
<SocialButtonsReversibleContainerWithDivider>
{(showOauthProviders || showWeb3Providers) && (
<SignUpSocialButtons
enableOAuthProviders={showOauthProviders}
enableWeb3Providers={showWeb3Providers}
/>
)}
<SignUpForm
handleSubmit={handleSubmit}
fields={fields}
formState={formState}
canToggleEmailPhone={canToggleEmailPhone}
handleEmailPhoneToggle={handleChangeActive}
/>
)}
<SignUpForm
handleSubmit={handleSubmit}
fields={fields}
formState={formState}
canToggleEmailPhone={canToggleEmailPhone}
handleEmailPhoneToggle={handleChangeActive}
/>
</SocialButtonsReversibleContainerWithDivider>
</Flex>
<Footer.Root>
<Footer.Action elementId='signUp'>
<Footer.ActionText localizationKey={localizationKeys('signUp.continue.actionText')} />
<Footer.ActionLink
localizationKey={localizationKeys('signUp.continue.actionLink')}
to={clerk.buildUrlWithAuth(signInUrl)}
/>
</Footer.Action>
<Footer.Links />
</Footer.Root>
</SocialButtonsReversibleContainerWithDivider>
</Flex>
</Card.Content>
<Card.Footer>
<Footer.Root>
<Footer.Action elementId='signUp'>
<Footer.ActionText localizationKey={localizationKeys('signUp.continue.actionText')} />
<Footer.ActionLink
localizationKey={localizationKeys('signUp.continue.actionLink')}
to={clerk.buildUrlWithAuth(signInUrl)}
/>
</Footer.Action>
<Footer.Links />
</Footer.Root>
</Card.Footer>
</Card.Root>
</Flow.Part>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('SignUpContinue', () => {
});
render(<SignUpContinue />, { wrapper });

const signInLink = screen.getByText('Have an account?').nextElementSibling;
const signInLink = screen.getByText('Already have an account?').nextElementSibling;
expect(signInLink?.textContent).toBe('Sign in');
expect(signInLink?.tagName.toUpperCase()).toBe('A');
expect(signInLink?.getAttribute('href')).toMatch(fixtures.environment.displayConfig.signInUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('SignUpStart', () => {
});
render(<SignUpStart />, { wrapper });

const signInLink = screen.getByText('Have an account?').nextElementSibling;
const signInLink = screen.getByText('Already have an account?').nextElementSibling;
expect(signInLink?.textContent).toBe('Sign in');
expect(signInLink?.tagName.toUpperCase()).toBe('A');
expect(signInLink?.getAttribute('href')).toMatch(fixtures.environment.displayConfig.signInUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('SignUpVerifyEmail', () => {

render(<SignUpVerifyEmail />, { wrapper });
screen.getByText(/Verify your email/i);
screen.getByText(/to continue to TestApp/i);
screen.getByText(/Enter the verification code sent to your email/i);
});

it('clicking on the edit icon navigates to the previous route', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('SignUpVerifyPhone', () => {
});
render(<SignUpVerifyPhone />, { wrapper });
screen.getByText(/Verify your phone/i);
screen.getByText(/to continue to TestApp/i);
screen.getByText(/Enter the verification code sent to your phone/i);
});

it('clicking on the edit icon navigates to the previous route', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/elements/LoadingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const LoadingCard = withCardStateProvider(() => {
<Card.Alert>{card.error}</Card.Alert>
<LoadingCardContainer />
</Card.Content>
<Card.Footer />
</Card.Root>
);
});
14 changes: 7 additions & 7 deletions packages/localizations/src/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export const enUS: LocalizationResource = {
signUp: {
start: {
title: 'Create your account',
subtitle: 'to continue to {{applicationName}}',
actionText: 'Have an account?',
subtitle: 'Welcome! Please fill in the details to get started.',
actionText: 'Already have an account?',
actionLink: 'Sign in',
},
emailLink: {
Expand All @@ -112,30 +112,30 @@ export const enUS: LocalizationResource = {
},
emailCode: {
title: 'Verify your email',
subtitle: 'to continue to {{applicationName}}',
subtitle: 'Enter the verification code sent to your email',
formTitle: 'Verification code',
formSubtitle: 'Enter the verification code sent to your email address',
resendButton: "Didn't receive a code? Resend",
},
phoneCode: {
title: 'Verify your phone',
subtitle: 'to continue to {{applicationName}}',
subtitle: 'Enter the verification code sent to your phone',
formTitle: 'Verification code',
formSubtitle: 'Enter the verification code sent to your phone number',
resendButton: "Didn't receive a code? Resend",
},
continue: {
title: 'Fill in missing fields',
subtitle: 'to continue to {{applicationName}}',
actionText: 'Have an account?',
subtitle: 'Please fill in the remaining details to continue.',
actionText: 'Already have an account?',
actionLink: 'Sign in',
},
},
signIn: {
start: {
title: 'Sign in to {{applicationName}}',
subtitle: 'Welcome back! Please sign in to continue',
actionText: 'No account?',
actionText: 'Don’t have an account?',
actionLink: 'Sign up',
actionLink__use_email: 'Use email',
actionLink__use_phone: 'Use phone',
Expand Down
Loading