Skip to content

Commit

Permalink
Remove isSelected boolean and inline InspectorControls
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Jul 16, 2018
1 parent ad5aa1d commit 0696d4c
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions core-blocks/archives/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,25 @@ import {
BlockControls,
} from '@wordpress/editor';

export default function ArchivesEdit( { attributes, isSelected, setAttributes } ) {
export default function ArchivesEdit( { attributes, setAttributes } ) {
const { align, showPostCounts, displayAsDropdown } = attributes;

const inspectorControls = isSelected && (
<InspectorControls key="inspector">
<PanelBody title={ __( 'Archives Settings' ) }>
<ToggleControl
label={ __( 'Show Post Counts' ) }
checked={ showPostCounts }
onChange={ () => setAttributes( { showPostCounts: ! showPostCounts } ) }
/>
<ToggleControl
label={ __( 'Display as Dropdown' ) }
checked={ displayAsDropdown }
onChange={ () => setAttributes( { displayAsDropdown: ! displayAsDropdown } ) }
/>
</PanelBody>
</InspectorControls>
);

return (
<Fragment>
{ inspectorControls }
<InspectorControls key="inspector">
<PanelBody title={ __( 'Archives Settings' ) }>
<ToggleControl
label={ __( 'Show Post Counts' ) }
checked={ showPostCounts }
onChange={ () => setAttributes( { showPostCounts: ! showPostCounts } ) }
/>
<ToggleControl
label={ __( 'Display as Dropdown' ) }
checked={ displayAsDropdown }
onChange={ () => setAttributes( { displayAsDropdown: ! displayAsDropdown } ) }
/>
</PanelBody>
</InspectorControls>
<BlockControls key="controls">
<BlockAlignmentToolbar
value={ align }
Expand Down

0 comments on commit 0696d4c

Please sign in to comment.