Skip to content

Commit 8af3f7e

Browse files
authored
Merge pull request #7996 from google/icon-followup-revert
2 parents e4315b0 + 03fd24e commit 8af3f7e

File tree

52 files changed

+251
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+251
-96
lines changed

assets/js/components/KeyMetrics/ChangeMetricsLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ export default function ChangeMetricsLink() {
6666
linkButton
6767
className="googlesitekit-km-change-metrics-cta"
6868
onClick={ openMetricsSelectionPanel }
69+
leadingIcon={ <PencilIcon width={ 22 } height={ 22 } /> }
6970
>
70-
<PencilIcon width={ 22 } height={ 22 } />
7171
{ __( 'Change Metrics', 'google-site-kit' ) }
7272
</Link>
7373
<SetupCompletedSurveyTrigger />

assets/js/components/Link.js

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ const Link = forwardRef( ( props, ref ) => {
6464
standalone = false,
6565
linkButton = false,
6666
to,
67+
leadingIcon,
68+
trailingIcon,
6769
...otherProps
6870
} = props;
6971

@@ -151,6 +153,27 @@ const Link = forwardRef( ( props, ref ) => {
151153
const LinkComponent = getLinkComponent();
152154
const ariaLabel = getAriaLabel();
153155

156+
// Set the prefix/suffix icons, based on the type of link this is and
157+
// the props supplied.
158+
let leadingIconToUse = leadingIcon;
159+
let trailingIconToUse = trailingIcon;
160+
161+
if ( back ) {
162+
leadingIconToUse = <BackIcon width={ 14 } height={ 14 } />;
163+
}
164+
165+
if ( external && ! hideExternalIndicator ) {
166+
trailingIconToUse = <ExternalIcon width={ 14 } height={ 14 } />;
167+
}
168+
169+
if ( arrow && ! inverse ) {
170+
trailingIconToUse = <ArrowIcon width={ 14 } height={ 14 } />;
171+
}
172+
173+
if ( arrow && inverse ) {
174+
trailingIconToUse = <ArrowInverseIcon width={ 14 } height={ 14 } />;
175+
}
176+
154177
return (
155178
<LinkComponent
156179
aria-label={ ariaLabel }
@@ -177,23 +200,17 @@ const Link = forwardRef( ( props, ref ) => {
177200
to={ to }
178201
{ ...otherProps }
179202
>
180-
{ back && (
203+
{ !! leadingIconToUse && (
181204
<IconWrapper marginRight={ 5 }>
182-
<BackIcon width={ 14 } height={ 14 } />
205+
{ leadingIconToUse }
183206
</IconWrapper>
184207
) }
185-
<span>{ children }</span>
186-
{ external && ! hideExternalIndicator && (
208+
<span className="googlesitekit-cta-link__contents">
209+
{ children }
210+
</span>
211+
{ !! trailingIconToUse && (
187212
<IconWrapper marginLeft={ 5 }>
188-
<ExternalIcon width={ 14 } height={ 14 } />
189-
</IconWrapper>
190-
) }
191-
{ arrow && (
192-
<IconWrapper marginLeft={ 5 }>
193-
{ ! inverse && <ArrowIcon width={ 14 } height={ 14 } /> }
194-
{ inverse && (
195-
<ArrowInverseIcon width={ 14 } height={ 14 } />
196-
) }
213+
{ trailingIconToUse }
197214
</IconWrapper>
198215
) }
199216
</LinkComponent>
@@ -212,11 +229,13 @@ Link.propTypes = {
212229
hideExternalIndicator: PropTypes.bool,
213230
href: PropTypes.string,
214231
inverse: PropTypes.bool,
232+
leadingIcon: PropTypes.node,
233+
linkButton: PropTypes.bool,
215234
onClick: PropTypes.func,
216235
small: PropTypes.bool,
217236
standalone: PropTypes.bool,
218-
linkButton: PropTypes.bool,
219237
to: PropTypes.string,
238+
trailingIcon: PropTypes.node,
220239
};
221240

222241
export default Link;

assets/js/components/notifications/__snapshots__/ErrorNotifications.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ exports[`ErrorNotifications renders the GTE message when the only unsatisfied sc
237237
rel="noopener noreferrer"
238238
target="_blank"
239239
>
240-
<span>
240+
<span
241+
class="googlesitekit-cta-link__contents"
242+
>
241243
Learn more
242244
</span>
243245
<span

assets/js/components/settings/SettingsActiveModule/Footer.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,15 @@ export default function Footer( props ) {
245245
__( 'Edit %s settings', 'google-site-kit' ),
246246
name
247247
) }
248+
trailingIcon={
249+
<PencilIcon
250+
className="googlesitekit-settings-module__edit-button-icon"
251+
width={ 10 }
252+
height={ 10 }
253+
/>
254+
}
248255
>
249256
{ __( 'Edit', 'google-site-kit' ) }
250-
<PencilIcon
251-
className="googlesitekit-settings-module__edit-button-icon"
252-
width="10"
253-
height="10"
254-
/>
255257
</Link>
256258
);
257259
}
@@ -262,17 +264,19 @@ export default function Footer( props ) {
262264
className="googlesitekit-settings-module__remove-button"
263265
onClick={ handleDialog }
264266
danger
267+
trailingIcon={
268+
<TrashIcon
269+
className="googlesitekit-settings-module__remove-button-icon"
270+
width={ 13 }
271+
height={ 13 }
272+
/>
273+
}
265274
>
266275
{ sprintf(
267276
/* translators: %s: module name */
268277
__( 'Disconnect %s from Site Kit', 'google-site-kit' ),
269278
name
270279
) }
271-
<TrashIcon
272-
className="googlesitekit-settings-module__remove-button-icon"
273-
width="13"
274-
height="13"
275-
/>
276280
</Link>
277281
);
278282
} else if ( ! isEditing && moduleHomepage ) {

assets/js/components/setup/__snapshots__/SetupUsingProxyWithSignIn.test.js.snap

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ exports[`SetupUsingProxyWithSignIn should not render the Activate Analytics noti
1919
class="googlesitekit-cta-link googlesitekit-header__logo-link"
2020
href=""
2121
>
22-
<span>
22+
<span
23+
class="googlesitekit-cta-link__contents"
24+
>
2325
<div
2426
aria-hidden="true"
2527
class="googlesitekit-logo"
@@ -77,7 +79,9 @@ exports[`SetupUsingProxyWithSignIn should not render the Activate Analytics noti
7779
tabindex="-1"
7880
target="_blank"
7981
>
80-
<span>
82+
<span
83+
class="googlesitekit-cta-link__contents"
84+
>
8185
Fix common issues
8286
</span>
8387
</a>
@@ -96,7 +100,9 @@ exports[`SetupUsingProxyWithSignIn should not render the Activate Analytics noti
96100
tabindex="-1"
97101
target="_blank"
98102
>
99-
<span>
103+
<span
104+
class="googlesitekit-cta-link__contents"
105+
>
100106
Read help docs
101107
</span>
102108
</a>
@@ -115,7 +121,9 @@ exports[`SetupUsingProxyWithSignIn should not render the Activate Analytics noti
115121
tabindex="-1"
116122
target="_blank"
117123
>
118-
<span>
124+
<span
125+
class="googlesitekit-cta-link__contents"
126+
>
119127
Get support
120128
</span>
121129
</a>
@@ -286,7 +294,9 @@ exports[`SetupUsingProxyWithSignIn should not render the Activate Analytics noti
286294
rel="noopener noreferrer"
287295
target="_blank"
288296
>
289-
<span>
297+
<span
298+
class="googlesitekit-cta-link__contents"
299+
>
290300
Google Privacy Policy.
291301
</span>
292302
<span
@@ -346,7 +356,9 @@ exports[`SetupUsingProxyWithSignIn should render the setup page, including the A
346356
class="googlesitekit-cta-link googlesitekit-header__logo-link"
347357
href=""
348358
>
349-
<span>
359+
<span
360+
class="googlesitekit-cta-link__contents"
361+
>
350362
<div
351363
aria-hidden="true"
352364
class="googlesitekit-logo"
@@ -404,7 +416,9 @@ exports[`SetupUsingProxyWithSignIn should render the setup page, including the A
404416
tabindex="-1"
405417
target="_blank"
406418
>
407-
<span>
419+
<span
420+
class="googlesitekit-cta-link__contents"
421+
>
408422
Fix common issues
409423
</span>
410424
</a>
@@ -423,7 +437,9 @@ exports[`SetupUsingProxyWithSignIn should render the setup page, including the A
423437
tabindex="-1"
424438
target="_blank"
425439
>
426-
<span>
440+
<span
441+
class="googlesitekit-cta-link__contents"
442+
>
427443
Read help docs
428444
</span>
429445
</a>
@@ -442,7 +458,9 @@ exports[`SetupUsingProxyWithSignIn should render the setup page, including the A
442458
tabindex="-1"
443459
target="_blank"
444460
>
445-
<span>
461+
<span
462+
class="googlesitekit-cta-link__contents"
463+
>
446464
Get support
447465
</span>
448466
</a>
@@ -667,7 +685,9 @@ exports[`SetupUsingProxyWithSignIn should render the setup page, including the A
667685
rel="noopener noreferrer"
668686
target="_blank"
669687
>
670-
<span>
688+
<span
689+
class="googlesitekit-cta-link__contents"
690+
>
671691
Google Privacy Policy.
672692
</span>
673693
<span

assets/js/components/user-input/UserInputPreviewGroup.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,11 @@ export default function UserInputPreviewGroup( {
193193
( !! currentlyEditingSlug && ! isEditing )
194194
}
195195
linkButton
196+
trailingIcon={
197+
<ChevronDownIcon width={ 20 } height={ 20 } />
198+
}
196199
>
197200
{ __( 'Edit', 'google-site-kit' ) }
198-
199-
<ChevronDownIcon width={ 20 } height={ 20 } />
200201
</Link>
201202
</LoadingWrapper>
202203
</div>

assets/js/googlesitekit/widgets/components/__snapshots__/WPDashboardReportError.test.js.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ exports[`WPDashboardReportError should only render one error per module when the
3636
rel="noopener noreferrer"
3737
target="_blank"
3838
>
39-
<span>
39+
<span
40+
class="googlesitekit-cta-link__contents"
41+
>
4042
Get help
4143
</span>
4244
</a>
@@ -76,7 +78,9 @@ exports[`WPDashboardReportError should only render one error per module when the
7678
rel="noopener noreferrer"
7779
target="_blank"
7880
>
79-
<span>
81+
<span
82+
class="googlesitekit-cta-link__contents"
83+
>
8084
Get help
8185
</span>
8286
</a>

assets/js/modules/adsense/components/widgets/__snapshots__/ConnectAdSenseCTATileWidget.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ exports[`ConnectAdSenseCTATileWidget should render the Connect AdSense CTA tile
2525
<button
2626
class="googlesitekit-cta-link googlesitekit-cta-link--secondary"
2727
>
28-
<span>
28+
<span
29+
class="googlesitekit-cta-link__contents"
30+
>
2931
Connect AdSense
3032
</span>
3133
</button>

assets/js/modules/analytics-4/components/common/__snapshots__/EnhancedMeasurementSwitch.test.js.snap

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ exports[`EnhancedMeasurementSwitch should render correctly in the already enable
1919
rel="noopener noreferrer"
2020
target="_blank"
2121
>
22-
<span>
22+
<span
23+
class="googlesitekit-cta-link__contents"
24+
>
2325
Learn more
2426
</span>
2527
<span
@@ -81,7 +83,9 @@ exports[`EnhancedMeasurementSwitch should render correctly in the default state
8183
rel="noopener noreferrer"
8284
target="_blank"
8385
>
84-
<span>
86+
<span
87+
class="googlesitekit-cta-link__contents"
88+
>
8589
Learn more
8690
</span>
8791
<span
@@ -144,7 +148,9 @@ exports[`EnhancedMeasurementSwitch should render correctly in the disabled state
144148
rel="noopener noreferrer"
145149
target="_blank"
146150
>
147-
<span>
151+
<span
152+
class="googlesitekit-cta-link__contents"
153+
>
148154
Learn more
149155
</span>
150156
<span
@@ -198,7 +204,9 @@ exports[`EnhancedMeasurementSwitch should render correctly in the loading state
198204
rel="noopener noreferrer"
199205
target="_blank"
200206
>
201-
<span>
207+
<span
208+
class="googlesitekit-cta-link__contents"
209+
>
202210
Learn more
203211
</span>
204212
<span

assets/js/modules/analytics-4/components/dashboard/EnhancedMeasurementActivationBanner/__snapshots__/SetupBanner.test.js.snap

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ exports[`SetupBanner should render correctly when the user does have the edit sc
4444
rel="noopener noreferrer"
4545
target="_blank"
4646
>
47-
<span>
47+
<span
48+
class="googlesitekit-cta-link__contents"
49+
>
4850
Learn more
4951
</span>
5052
<span
@@ -72,7 +74,9 @@ exports[`SetupBanner should render correctly when the user does have the edit sc
7274
<button
7375
class="googlesitekit-cta-link"
7476
>
75-
<span>
77+
<span
78+
class="googlesitekit-cta-link__contents"
79+
>
7680
Maybe later
7781
</span>
7882
</button>
@@ -137,7 +141,9 @@ exports[`SetupBanner should render correctly when the user does not have the edi
137141
rel="noopener noreferrer"
138142
target="_blank"
139143
>
140-
<span>
144+
<span
145+
class="googlesitekit-cta-link__contents"
146+
>
141147
Learn more
142148
</span>
143149
<span
@@ -165,7 +171,9 @@ exports[`SetupBanner should render correctly when the user does not have the edi
165171
<button
166172
class="googlesitekit-cta-link"
167173
>
168-
<span>
174+
<span
175+
class="googlesitekit-cta-link__contents"
176+
>
169177
Maybe later
170178
</span>
171179
</button>

0 commit comments

Comments
 (0)