Skip to content

Commit 19540e2

Browse files
Move Back button to topbar on Jetpack Connection screens (#103463)
* Remove back button from Connection screen footer * Add back button to the compact logo topbar * Use compact logo & menu in connection screens
1 parent 253da0a commit 19540e2

File tree

4 files changed

+51
-33
lines changed

4 files changed

+51
-33
lines changed

client/jetpack-connect/jetpack-connection.jsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { PLAN_JETPACK_FREE } from '@automattic/calypso-products';
22
import page from '@automattic/calypso-router';
3-
import { Button, Gridicon } from '@automattic/components';
43
import debugModule from 'debug';
54
import { localize } from 'i18n-calypso';
65
import { flowRight, get, omit } from 'lodash';
@@ -82,19 +81,6 @@ const jetpackConnection = ( WrappedComponent ) => {
8281
{ translate( 'Install Jetpack manually' ) }
8382
</LoggedOutFormLinkItem>
8483
<HelpButton />
85-
{ this.canGoBack() && (
86-
<div className="jetpack-connect__navigation">
87-
<Button
88-
compact
89-
borderless
90-
className="jetpack-connect__back-button"
91-
onClick={ this.goBack }
92-
>
93-
<Gridicon icon="arrow-left" size={ 18 } />
94-
{ translate( 'Back' ) }
95-
</Button>
96-
</div>
97-
) }
9884
</LoggedOutFormLinks>
9985
);
10086
};
@@ -325,6 +311,8 @@ const jetpackConnection = ( WrappedComponent ) => {
325311
status={ this.state.status }
326312
renderFooter={ this.renderFooter }
327313
renderNotices={ this.renderNotices }
314+
canGoBack={ this.canGoBack() }
315+
goBack={ this.goBack }
328316
isCurrentUrlFetching={ this.isCurrentUrlFetching() }
329317
{ ...props }
330318
/>

client/jetpack-connect/main-wrapper.jsx

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Button } from '@wordpress/components';
2+
import { chevronLeftSmall } from '@wordpress/icons';
13
import clsx from 'clsx';
24
import { localize } from 'i18n-calypso';
35
import PropTypes from 'prop-types';
@@ -20,6 +22,7 @@ export class JetpackConnectMainWrapper extends PureComponent {
2022
pageTitle: PropTypes.string,
2123
// Whether to use a compact logo in the left corner or the main center logo
2224
useCompactLogo: PropTypes.bool,
25+
compactBackButton: PropTypes.bool,
2326
};
2427

2528
static defaultProps = {
@@ -42,6 +45,7 @@ export class JetpackConnectMainWrapper extends PureComponent {
4245
wooDnaConfig,
4346
pageTitle,
4447
useCompactLogo,
48+
compactBackButton,
4549
} = this.props;
4650

4751
const isWooDna = wooDnaConfig && wooDnaConfig.isWooDnaFlow();
@@ -62,20 +66,33 @@ export class JetpackConnectMainWrapper extends PureComponent {
6266
return (
6367
<Main className={ clsx( className, wrapperClassName ) }>
6468
{ useCompactLogo && (
65-
<div className="jetpack-connect__compact-logo">
66-
<svg
67-
xmlns="http://www.w3.org/2000/svg"
68-
width="24"
69-
height="24"
70-
viewBox="0 0 24 24"
71-
fill="none"
72-
>
73-
<path
74-
d="M12 0C9.62663 0 7.30655 0.703788 5.33316 2.02236C3.35977 3.34094 1.8217 5.21508 0.913451 7.4078C0.00519938 9.60051 -0.232441 12.0133 0.230582 14.3411C0.693605 16.6689 1.83649 18.807 3.51472 20.4853C5.19295 22.1635 7.33115 23.3064 9.65892 23.7694C11.9867 24.2324 14.3995 23.9948 16.5922 23.0865C18.7849 22.1783 20.6591 20.6402 21.9776 18.6668C23.2962 16.6934 24 14.3734 24 12C24 8.8174 22.7357 5.76515 20.4853 3.51472C18.2348 1.26428 15.1826 0 12 0ZM11.3684 13.9895H5.40632L11.3684 2.35579V13.9895ZM12.5811 21.6189V9.98526H18.5621L12.5811 21.6189Z"
75-
fill="#069E08"
76-
/>
77-
</svg>
78-
</div>
69+
<>
70+
<div className="jetpack-connect__compact-logo">
71+
<svg
72+
xmlns="http://www.w3.org/2000/svg"
73+
width="24"
74+
height="24"
75+
viewBox="0 0 24 24"
76+
fill="none"
77+
>
78+
<path
79+
d="M12 0C9.62663 0 7.30655 0.703788 5.33316 2.02236C3.35977 3.34094 1.8217 5.21508 0.913451 7.4078C0.00519938 9.60051 -0.232441 12.0133 0.230582 14.3411C0.693605 16.6689 1.83649 18.807 3.51472 20.4853C5.19295 22.1635 7.33115 23.3064 9.65892 23.7694C11.9867 24.2324 14.3995 23.9948 16.5922 23.0865C18.7849 22.1783 20.6591 20.6402 21.9776 18.6668C23.2962 16.6934 24 14.3734 24 12C24 8.8174 22.7357 5.76515 20.4853 3.51472C18.2348 1.26428 15.1826 0 12 0ZM11.3684 13.9895H5.40632L11.3684 2.35579V13.9895ZM12.5811 21.6189V9.98526H18.5621L12.5811 21.6189Z"
80+
fill="#069E08"
81+
/>
82+
</svg>
83+
{ compactBackButton && (
84+
<Button
85+
compact
86+
borderless
87+
icon={ chevronLeftSmall }
88+
className="jetpack-connect__back-button jetpack-connect__back-button--compact"
89+
onClick={ compactBackButton }
90+
>
91+
{ translate( 'Back' ) }
92+
</Button>
93+
) }
94+
</div>
95+
</>
7996
) }
8097
<DocumentHead
8198
title={ pageTitle || translate( 'Jetpack Connect' ) }

client/jetpack-connect/main.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ export class JetpackConnectMain extends Component {
124124
}
125125

126126
render() {
127-
const { renderFooter, status, type } = this.props;
127+
const { renderFooter, status, type, canGoBack, goBack } = this.props;
128128
return (
129-
<MainWrapper>
129+
<MainWrapper useCompactLogo compactBackButton={ canGoBack && goBack }>
130130
{ this.renderLocaleSuggestions() }
131131
<div className="jetpack-connect__site-url-entry-container">
132132
<MainHeader type={ type } />

client/jetpack-connect/style.scss

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ $colophon-height: 50px;
5151
&.layout {
5252
position: relative;
5353
min-height: calc(100% - #{$colophon-height});
54-
padding-bottom: $colophon-height;
5554
}
5655

5756
// Hide the masterbar for real
@@ -125,9 +124,24 @@ $colophon-height: 50px;
125124
}
126125

127126
.jetpack-connect__compact-logo {
127+
display: flex;
128128
position: absolute;
129129
top: 24px;
130130
left: 24px;
131+
132+
align-items: center;
133+
column-gap: 16px;
134+
135+
.jetpack-connect__back-button {
136+
--wp-components-color-accent: var(--color-accent-dark);
137+
138+
margin-top: 0;
139+
140+
&:focus {
141+
outline: none;
142+
box-shadow: none;
143+
}
144+
}
131145
}
132146

133147
.jetpack-connect__main.is-wide {
@@ -144,7 +158,7 @@ $colophon-height: 50px;
144158

145159
.jetpack-connect__site-url-entry-container,
146160
.purchase-product__site-url-entry-container {
147-
margin: 0 auto;
161+
margin: 10vh auto 0; // match spacing of onboarding flow (.jetpack-connect__authorize-form-wrapper--onboarding)
148162
max-width: 400px;
149163

150164
.formatted-header {
@@ -839,7 +853,6 @@ $colophon-height: 50px;
839853
&.layout {
840854
position: relative;
841855
min-height: calc(100% - #{$colophon-height});
842-
padding-bottom: $colophon-height;
843856
}
844857

845858
.site__title::after,

0 commit comments

Comments
 (0)