Skip to content

Commit f3c13a2

Browse files
authored
Use core button component for continue as user screens (#103097)
* Use core button component for continue as user * Use core components for all buttons in screen * Theme akismet * Theme Blaze Pro * Theme Woo * Update oauth continue as user screen to better match white login layout * Theme Jetpack * Theme A4A * Revert underlining button * Fix and theme Crowdsignal * Fix Blaze Pro back navigation layout * Fix Woo mobile back navigation layout
1 parent 5da7121 commit f3c13a2

File tree

11 files changed

+82
-100
lines changed

11 files changed

+82
-100
lines changed

client/assets/stylesheets/_wp-components-overrides.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
--wp-components-color-accent-darker-20: var(--color-accent-60);
3636
}
3737

38+
.components-button.is-link:not(.is-destructive) {
39+
// Text color, focus ring color
40+
--wp-components-color-accent: var(--color-accent);
41+
}
42+
3843
/* @wordpress/components ButtonGroup overrides */
3944
.components-button-group {
4045
.components-button {

client/blocks/login/continue-as-user.jsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Button } from '@automattic/components';
1+
import { Button } from '@wordpress/components';
22
import { useTranslate } from 'i18n-calypso';
33
import { useEffect, useState } from 'react';
44
import Gravatar from 'calypso/components/gravatar';
@@ -54,8 +54,8 @@ export default function ContinueAsUser( {
5454
components: {
5555
br: <br />,
5656
link: (
57-
<button
58-
type="button"
57+
<Button
58+
variant="link"
5959
id="loginAsAnotherUser"
6060
className="continue-as-user__change-user-link"
6161
onClick={ onChangeAccount }
@@ -85,21 +85,22 @@ export default function ContinueAsUser( {
8585
<div className="continue-as-user__user-info">
8686
{ gravatarLink }
8787
<div className="continue-as-user__not-you">
88-
<button
89-
type="button"
88+
<Button
89+
variant="tertiary"
9090
id="loginAsAnotherUser"
9191
className="continue-as-user__change-user-link"
9292
onClick={ onChangeAccount }
9393
>
9494
{ translate( 'Sign in as a different user' ) }
95-
</button>
95+
</Button>
9696
</div>
9797
</div>
9898
<Button
99-
primary
99+
variant="primary"
100100
className="continue-as-user__continue-button"
101-
busy={ validatingPath }
101+
isBusy={ validatingPath }
102102
href={ validatedPath || '/' }
103+
__next40pxDefaultSize
103104
>
104105
{ translate( 'Continue' ) }
105106
</Button>
@@ -113,21 +114,22 @@ export default function ContinueAsUser( {
113114
<div className="continue-as-user__user-info">
114115
{ gravatarLink }
115116
<div className="continue-as-user__not-you">
116-
<button
117-
type="button"
117+
<Button
118+
variant="tertiary"
118119
id="loginAsAnotherUser"
119120
className="continue-as-user__change-user-link"
120121
onClick={ onChangeAccount }
121122
>
122123
{ translate( 'Sign in as a different user' ) }
123-
</button>
124+
</Button>
124125
</div>
125126
</div>
126127
<Button
127-
primary
128+
variant="primary"
128129
className="continue-as-user__continue-button"
129-
busy={ validatingPath }
130+
isBusy={ validatingPath }
130131
href={ validatedPath || '/' }
132+
__next40pxDefaultSize
131133
>
132134
{ `${ translate( 'Continue as', {
133135
context: 'Continue as an existing WordPress.com user',
@@ -142,7 +144,13 @@ export default function ContinueAsUser( {
142144
<div className="continue-as-user">
143145
<div className="continue-as-user__user-info">
144146
{ gravatarLink }
145-
<Button primary busy={ validatingPath } href={ validatedPath || '/' }>
147+
<Button
148+
variant="primary"
149+
isBusy={ validatingPath }
150+
href={ validatedPath || '/' }
151+
__next40pxDefaultSize
152+
className="continue-as-user__continue-button"
153+
>
146154
{ translate( 'Continue' ) }
147155
</Button>
148156
</div>

client/blocks/login/continue-as-user.scss

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
@import "@wordpress/base-styles/breakpoints";
33

44
.continue-as-user {
5-
display: block;
5+
display: flex;
6+
flex-direction: column;
67
animation: 1s appear 0s ease-in;
78
color: var(--color-text-subtle);
89
font-size: $font-body-small;
@@ -23,28 +24,16 @@
2324
margin: 0 auto;
2425
display: flex;
2526
flex-direction: column;
26-
27-
& > a.button {
28-
margin: 0 20px;
29-
border-radius: 4px;
30-
}
3127
}
3228

3329
.continue-as-user__gravatar {
3430
display: inline;
3531
border: 1px solid #a7aaad;
3632
}
3733

38-
.continue-as-user__change-user-link {
39-
color: var(--color-link);
40-
cursor: pointer;
41-
margin: auto;
42-
43-
&:hover,
44-
&:focus,
45-
&:active {
46-
color: var(--color-link-dark);
47-
}
34+
.continue-as-user__continue-button {
35+
min-width: 100%;
36+
margin-block: 13px;
4837
}
4938

5039
.continue-as-user__not-you {

client/blocks/login/login-form.scss

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,23 @@ form {
5454
}
5555
}
5656
}
57+
58+
&.is-akismet {
59+
.login,
60+
.magic-login {
61+
.components-button {
62+
--color-accent: var(--color-akismet);
63+
--color-accent-60: var(--color-akismet);
64+
}
65+
}
66+
}
5767
}
5868

5969
.is-jetpack .login__form-account-tip {
6070
margin-block-start: -8px;
6171
font-size: 0.75rem;
6272
}
6373

64-
.layout.is-white-login .login.is-akismet .login__form,
65-
.layout.is-white-login .login.is-akismet .continue-as-user,
66-
.layout.is-white-login.is-akismet .magic-login__form-action {
67-
.button.is-primary {
68-
background-color: var(--color-akismet);
69-
70-
&:hover,
71-
&:focus {
72-
background-color: var(--color-akismet);
73-
}
74-
}
75-
76-
.components-button.is-primary {
77-
--color-accent: var(--color-akismet);
78-
--color-accent-60: var(--color-akismet);
79-
}
80-
}
81-
8274
.login__form-jetpack {
8375
.card.login__form {
8476
box-shadow: none;

client/blocks/signup-form/crowdsignal.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ body.is-section-signup .layout .signup.is-crowdsignal .step-wrapper {
4444
}
4545
}
4646

47-
.signup-form__crowdsignal {
47+
.signup.is-crowdsignal {
4848
.components-button {
49-
width: 100%;
50-
5149
&.is-primary:not(.signup-form__crowdsignal-wpcom) {
5250
--color-accent: var(--color-primary);
5351
--color-accent-60: var(--color-primary-dark);
@@ -143,6 +141,10 @@ body.is-section-signup .layout .signup.is-crowdsignal .step-wrapper {
143141
margin: 0 auto;
144142
max-width: 320px;
145143
width: 100%;
144+
145+
.components-button {
146+
width: 100%;
147+
}
146148
}
147149

148150
.signup-form__crowdsignal-card-subheader {

client/blocks/signup-form/index.jsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,18 @@ class SignupForm extends Component {
10881088
return null;
10891089
}
10901090

1091+
if ( this.props.currentUser && ! this.props.disableContinueAsUser ) {
1092+
return (
1093+
<ContinueAsUser
1094+
currentUser={ this.props.currentUser }
1095+
onChangeAccount={ this.handleOnChangeAccount }
1096+
redirectPath={ this.props.redirectToAfterLoginUrl }
1097+
isWoo={ this.props.isWoo }
1098+
isBlazePro={ this.props.isBlazePro }
1099+
/>
1100+
);
1101+
}
1102+
10911103
if ( isCrowdsignalOAuth2Client( this.props.oauth2Client ) ) {
10921104
const socialProps = pick( this.props, [
10931105
'isSocialSignupEnabled',
@@ -1109,18 +1121,6 @@ class SignupForm extends Component {
11091121
);
11101122
}
11111123

1112-
if ( this.props.currentUser && ! this.props.disableContinueAsUser ) {
1113-
return (
1114-
<ContinueAsUser
1115-
currentUser={ this.props.currentUser }
1116-
onChangeAccount={ this.handleOnChangeAccount }
1117-
redirectPath={ this.props.redirectToAfterLoginUrl }
1118-
isWoo={ this.props.isWoo }
1119-
isBlazePro={ this.props.isBlazePro }
1120-
/>
1121-
);
1122-
}
1123-
11241124
if ( this.props.isJetpackWooDnaFlow ) {
11251125
return (
11261126
<div className={ clsx( 'signup-form__woocommerce', this.props.className ) }>

client/layout/index.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ import { isInStepContainerV2FlowContext } from 'calypso/layout/utils';
2525
import isA8CForAgencies from 'calypso/lib/a8c-for-agencies/is-a8c-for-agencies';
2626
import isJetpackCloud from 'calypso/lib/jetpack/is-jetpack-cloud';
2727
import { isWcMobileApp, isWpMobileApp } from 'calypso/lib/mobile-app';
28-
import { isWooOAuth2Client } from 'calypso/lib/oauth2-clients';
28+
import {
29+
isWooOAuth2Client,
30+
isJetpackCloudOAuth2Client,
31+
isA4AOAuth2Client,
32+
isCrowdsignalOAuth2Client,
33+
} from 'calypso/lib/oauth2-clients';
2934
import isReaderTagEmbedPage from 'calypso/lib/reader/is-reader-tag-embed-page';
3035
import { getMessagePathForJITM } from 'calypso/lib/route';
3136
import UserVerificationChecker from 'calypso/lib/user/verification-checker';
@@ -193,6 +198,8 @@ class Layout extends Component {
193198
const sectionClass = clsx( 'layout', `focus-${ this.props.currentLayoutFocus }`, {
194199
[ 'is-group-' + this.props.sectionGroup ]: this.props.sectionGroup,
195200
[ 'is-section-' + this.props.sectionName ]: this.props.sectionName,
201+
'a8c-for-agencies': isA4AOAuth2Client( this.props.oauth2Client ),
202+
crowdsignal: isCrowdsignalOAuth2Client( this.props.oauth2Client ),
196203
'is-support-session': this.props.isSupportSession,
197204
'has-no-sidebar': this.props.sidebarIsHidden,
198205
'has-no-masterbar': this.props.masterbarIsHidden,
@@ -209,6 +216,7 @@ class Layout extends Component {
209216
'is-unified-site-sidebar-visible': this.props.isUnifiedSiteSidebarVisible,
210217
'is-blaze-pro': this.props.isBlazePro,
211218
'is-woo-com-oauth': isWooOAuth2Client( this.props.oauth2Client ),
219+
'jetpack-cloud': isJetpackCloudOAuth2Client( this.props.oauth2Client ),
212220
'feature-flag-woocommerce-core-profiler-passwordless-auth': true,
213221
} );
214222

client/layout/masterbar/blaze-pro.scss

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ body.is-section-signup {
100100

101101
@media (max-width: $break-mobile) {
102102
display: flex;
103+
padding-inline: 24px;
103104
}
104105

105106
.masterbar__login-back-link {
@@ -126,6 +127,7 @@ body.is-section-signup {
126127
margin: 0;
127128
list-style-type: none;
128129
width: 100%;
130+
gap: 12px;
129131

130132
.masterbar__login-back-link {
131133
// margin-top: -10px;
@@ -224,7 +226,7 @@ body.is-section-signup {
224226
align-items: center;
225227
align-self: stretch;
226228
border: 1px solid #ccc;
227-
height: 221px;
229+
width: 100%;
228230
box-sizing: border-box;
229231
padding: 32px 24px 16px 24px;
230232
position: relative;
@@ -282,23 +284,14 @@ body.is-section-signup {
282284
}
283285

284286
.continue-as-user__change-user-link {
285-
font-family: $inter;
286287
font-size: 0.875rem;
287-
font-style: normal;
288288
font-weight: 500;
289-
line-height: 20px;
290-
text-decoration: none;
291289
}
292290

293291
.continue-as-user__continue-button {
294-
background: var(--color-orange);
295-
border-color: var(--color-orange);
296-
font-family: $inter;
297292
font-size: rem(13px);
298293
font-weight: 600;
299-
line-height: 14px;
300294
margin-top: 24px;
301-
padding: 12px 16px;
302295
width: 326px;
303296
}
304297
}

client/layout/masterbar/oauth-client.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@
600600
}
601601

602602
.jetpack-cloud {
603+
--color-link: var(--studio-jetpack-green-40);
604+
--color-link-dark: var(--studio-jetpack-green-60);
605+
603606
input:focus:hover[type],
604607
input:focus[type] {
605608
box-shadow: 0 0 0 2px var(--color-primary-10);
@@ -663,8 +666,6 @@
663666
--color-accent-60: var(--studio-jetpack-green-30);
664667
}
665668

666-
a,
667-
a:visited,
668669
.login__form-change-username,
669670
.wp-login__links button {
670671
color: var(--studio-jetpack-green-40);
@@ -677,6 +678,9 @@
677678
}
678679

679680
.a8c-for-agencies {
681+
--color-link: var(--color-primary-40);
682+
--color-link-dark: var(--color-primary-60);
683+
680684
input:focus:hover[type],
681685
input:focus[type] {
682686
box-shadow: 0 0 0 2px var(--color-primary-10);
@@ -740,8 +744,6 @@
740744
--color-accent-60: var(--color-primary-60);
741745
}
742746

743-
a,
744-
a:visited,
745747
.login__form-change-username,
746748
.wp-login__links button {
747749
color: var(--color-primary-40);

0 commit comments

Comments
 (0)