Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make usage of the settings icon more consistent #63020

Merged
merged 7 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
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
132 changes: 60 additions & 72 deletions packages/block-library/src/query/edit/query-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import {
ToolbarGroup,
Dropdown,
ToolbarButton,
BaseControl,
__experimentalNumberControl as NumberControl,
} from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
import { settings } from '@wordpress/icons';

Expand All @@ -25,10 +23,6 @@ export default function QueryToolbar( {
clientId,
} ) {
const hasPatterns = !! usePatterns( clientId, name ).length;
const maxPageInputId = useInstanceId(
QueryToolbar,
'blocks-query-pagination-max-page-input'
);

return (
<>
Expand All @@ -45,75 +39,69 @@ export default function QueryToolbar( {
) }
renderContent={ () => (
<>
<BaseControl>
<NumberControl
__unstableInputWidth="60px"
label={ __( 'Items per Page' ) }
labelPosition="edge"
min={ 1 }
max={ 100 }
onChange={ ( value ) => {
if (
isNaN( value ) ||
value < 1 ||
value > 100
) {
return;
}
setQuery( {
perPage: value,
} );
} }
step="1"
value={ query.perPage }
isDragEnabled={ false }
/>
</BaseControl>
<BaseControl>
<NumberControl
__unstableInputWidth="60px"
label={ __( 'Offset' ) }
labelPosition="edge"
min={ 0 }
max={ 100 }
onChange={ ( value ) => {
if (
isNaN( value ) ||
value < 0 ||
value > 100
) {
return;
}
setQuery( { offset: value } );
} }
step="1"
value={ query.offset }
isDragEnabled={ false }
/>
</BaseControl>
<BaseControl
id={ maxPageInputId }
<NumberControl
__unstableInputWidth="60px"
className="block-library-query-toolbar__popover-number-control"
label={ __( 'Items per Page' ) }
labelPosition="edge"
min={ 1 }
max={ 100 }
onChange={ ( value ) => {
if (
isNaN( value ) ||
value < 1 ||
value > 100
) {
return;
}
setQuery( {
perPage: value,
} );
} }
step="1"
value={ query.perPage }
isDragEnabled={ false }
/>
<NumberControl
__unstableInputWidth="60px"
className="block-library-query-toolbar__popover-number-control"
label={ __( 'Offset' ) }
labelPosition="edge"
min={ 0 }
max={ 100 }
onChange={ ( value ) => {
if (
isNaN( value ) ||
value < 0 ||
value > 100
) {
return;
}
setQuery( { offset: value } );
} }
step="1"
value={ query.offset }
isDragEnabled={ false }
/>
<NumberControl
__unstableInputWidth="60px"
className="block-library-query-toolbar__popover-number-control"
label={ __( 'Max pages to show' ) }
labelPosition="edge"
min={ 0 }
onChange={ ( value ) => {
if ( isNaN( value ) || value < 0 ) {
return;
}
setQuery( { pages: value } );
} }
step="1"
value={ query.pages }
isDragEnabled={ false }
help={ __(
'Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).'
) }
>
<NumberControl
id={ maxPageInputId }
__unstableInputWidth="60px"
label={ __( 'Max page to show' ) }
labelPosition="edge"
min={ 0 }
onChange={ ( value ) => {
if ( isNaN( value ) || value < 0 ) {
return;
}
setQuery( { pages: value } );
} }
step="1"
value={ query.pages }
isDragEnabled={ false }
/>
</BaseControl>
/>
</>
) }
/>
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/query/editor.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.block-library-query-toolbar__popover .components-popover__content {
min-width: 230px;

.block-library-query-toolbar__popover-number-control {
margin-bottom: $grid-unit-10;
}
}

.wp-block-query__create-new-link {
Expand Down
4 changes: 2 additions & 2 deletions packages/dataviews/src/view-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { memo } from '@wordpress/element';
import { settings } from '@wordpress/icons';
import { cog } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -314,7 +314,7 @@ function _ViewActions< Item >( {
trigger={
<Button
size="compact"
icon={ settings }
icon={ cog }
label={ __( 'View options' ) }
/>
}
Expand Down
Loading