Skip to content

Commit

Permalink
User collapsed toolbar buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ajitbohra committed Feb 6, 2019
1 parent 7aaa2de commit 8556628
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 15 additions & 12 deletions packages/block-library/src/latest-posts/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
Spinner,
ToggleControl,
Toolbar,
DropdownMenu
} from '@wordpress/components';
import apiFetch from '@wordpress/api-fetch';
import { addQueryArgs } from '@wordpress/url';
Expand Down Expand Up @@ -84,6 +83,21 @@ class LatestPostsEdit extends Component {

const inspectorControls = (
<InspectorControls>
<PanelBody title={ __( 'Display Settings' ) }>
<QueryControls
onNumberOfItemsChange={ ( value ) => setAttributes( { postsToShow: value } ) }
/>
{ postLayout === 'grid' &&
<RangeControl
label={ __( 'Columns' ) }
value={ columns }
onChange={ ( value ) => setAttributes( { columns: value } ) }
min={ 2 }
max={ ! hasPosts ? MAX_POSTS_COLUMNS : Math.min( MAX_POSTS_COLUMNS, latestPosts.length ) }
/>
}
</PanelBody>

<PanelBody title={ __( 'Post Meta Settings' ) }>
<ToggleControl
label={ __( 'Display post date' ) }
Expand All @@ -101,18 +115,7 @@ class LatestPostsEdit extends Component {
onOrderChange={ ( value ) => setAttributes( { order: value } ) }
onOrderByChange={ ( value ) => setAttributes( { orderBy: value } ) }
onCategoryChange={ ( value ) => setAttributes( { categories: '' !== value ? value : undefined } ) }
onNumberOfItemsChange={ ( value ) => setAttributes( { postsToShow: value } ) }
/>

{ postLayout === 'grid' &&
<RangeControl
label={ __( 'Columns' ) }
value={ columns }
onChange={ ( value ) => setAttributes( { columns: value } ) }
min={ 2 }
max={ ! hasPosts ? MAX_POSTS_COLUMNS : Math.min( MAX_POSTS_COLUMNS, latestPosts.length ) }
/>
}
</PanelBody>
</InspectorControls>
);
Expand Down

0 comments on commit 8556628

Please sign in to comment.