Skip to content

Commit caad88e

Browse files
authored
Performance settings: migrate ToggleControl to @wordpress/components (#48177)
Direct swap of the three ToggleControl usages on the Jetpack Performance settings screen off the @automattic/jetpack-components wrapper onto the upstream @wordpress/components primitive. Preserves click-blocking during save operations by merging the wrapper's `toggling` prop into the existing `disabled` prop. Part of #48160.
1 parent 191e02e commit caad88e

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

projects/plugins/jetpack/_inc/client/performance/media.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ProgressBar, ToggleControl, getRedirectUrl } from '@automattic/jetpack-components';
1+
import { ProgressBar, getRedirectUrl } from '@automattic/jetpack-components';
2+
import { ToggleControl } from '@wordpress/components';
23
import { createInterpolateElement } from '@wordpress/element';
34
import { __, _x, sprintf } from '@wordpress/i18n';
45
import { Component } from 'react';
@@ -114,9 +115,12 @@ class Media extends Component {
114115
</ModuleToggle>
115116
<FormFieldset>
116117
<ToggleControl
118+
__nextHasNoMarginBottom
117119
id="videopress-site-privacy"
118-
disabled={ ! this.props.getOptionValue( 'videopress' ) }
119-
toggling={ this.props.isSavingAnyOption( 'videopress_private_enabled_for_site' ) }
120+
disabled={
121+
! this.props.getOptionValue( 'videopress' ) ||
122+
this.props.isSavingAnyOption( 'videopress_private_enabled_for_site' )
123+
}
120124
checked={ this.props.getOptionValue( 'videopress_private_enabled_for_site' ) }
121125
onChange={ this.togglePrivacySetting }
122126
label={

projects/plugins/jetpack/_inc/client/performance/search.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ToggleControl, getRedirectUrl } from '@automattic/jetpack-components';
1+
import { getRedirectUrl } from '@automattic/jetpack-components';
2+
import { ToggleControl } from '@wordpress/components';
23
import { __ } from '@wordpress/i18n';
34
import { Fragment, useCallback, useEffect } from 'react';
45
import { connect } from 'react-redux';
@@ -92,9 +93,9 @@ function Search( props ) {
9293

9394
<FormFieldset>
9495
<ToggleControl
96+
__nextHasNoMarginBottom
9597
checked={ isModuleEnabled && isInstantSearchEnabled }
96-
disabled={ togglingModule || ! props.hasInstantSearch }
97-
toggling={ togglingInstantSearch }
98+
disabled={ togglingModule || ! props.hasInstantSearch || togglingInstantSearch }
9899
onChange={ toggleInstantSearch }
99100
label={
100101
<span className="jp-form-toggle-explanation">

projects/plugins/jetpack/_inc/client/performance/speed-up-site.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ToggleControl, getRedirectUrl } from '@automattic/jetpack-components';
1+
import { getRedirectUrl } from '@automattic/jetpack-components';
2+
import { ToggleControl } from '@wordpress/components';
23
import { __, sprintf } from '@wordpress/i18n';
34
import { Component } from 'react';
45
import { connect } from 'react-redux';
@@ -248,10 +249,10 @@ const SpeedUpSite = withModuleSettingsFormHelpers(
248249
</p>
249250
{ canAppearInSearch && (
250251
<ToggleControl
252+
__nextHasNoMarginBottom
251253
checked={ siteAcceleratorStatus }
252-
toggling={ togglingSiteAccelerator }
253254
onChange={ this.handleSiteAcceleratorChange }
254-
disabled={ ! canDisplaySiteAcceleratorSettings }
255+
disabled={ ! canDisplaySiteAcceleratorSettings || togglingSiteAccelerator }
255256
label={
256257
<span className="jp-form-toggle-explanation">
257258
{ __( 'Enable site accelerator', 'jetpack' ) }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: other
3+
4+
Performance settings: import ToggleControl from @wordpress/components instead of @automattic/jetpack-components.

0 commit comments

Comments
 (0)