Skip to content
Merged
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
23 changes: 15 additions & 8 deletions client/gutenberg/extensions/publicize/connection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* External dependencies
*/
import { Component } from '@wordpress/element';
import { FormToggle } from '@wordpress/components';
import { Disabled, FormToggle } from '@wordpress/components';

class PublicizeConnection extends Component {
onConnectionChange = () => {
Expand All @@ -25,6 +25,19 @@ class PublicizeConnection extends Component {
// Genericon names are dash separated
const socialName = name.replace( '_', '-' );

let toggle = (
<FormToggle
id={ fieldId }
className="jetpack-publicize-connection-toggle"
checked={ enabled }
onChange={ this.onConnectionChange }
/>
);

if ( ! toggleable ) {
toggle = <Disabled>{ toggle }</Disabled>;
}

return (
<li>
<div className="publicize-jetpack-connection-container">
Expand All @@ -36,13 +49,7 @@ class PublicizeConnection extends Component {
/>
<span>{ display_name }</span>
</label>
<FormToggle
id={ fieldId }
className="jetpack-publicize-connection-toggle"
checked={ enabled }
onChange={ this.onConnectionChange }
disabled={ ! toggleable }
/>
{ toggle }
</div>
</li>
);
Expand Down