From 2547508bcb14b75ace07889908659009cd3d8fd3 Mon Sep 17 00:00:00 2001 From: himanshupathak95 Date: Fri, 13 Dec 2024 12:53:07 +0530 Subject: [PATCH 1/2] Query Pagination: Refactor settings panel to use ToolsPanel --- .../src/query-pagination/edit.js | 55 ++++++++++++++----- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/packages/block-library/src/query-pagination/edit.js b/packages/block-library/src/query-pagination/edit.js index e051c2e67e7e5a..b59799cadb783b 100644 --- a/packages/block-library/src/query-pagination/edit.js +++ b/packages/block-library/src/query-pagination/edit.js @@ -9,7 +9,10 @@ import { store as blockEditorStore, } from '@wordpress/block-editor'; import { useSelect } from '@wordpress/data'; -import { PanelBody } from '@wordpress/components'; +import { + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, +} from '@wordpress/components'; import { useEffect } from '@wordpress/element'; /** @@ -60,22 +63,48 @@ export default function QueryPaginationEdit( { <> { hasNextPreviousBlocks && ( - - { - setAttributes( { paginationArrow: value } ); - } } - /> - { paginationArrow !== 'none' && ( - { + setAttributes( { + paginationArrow: 'none', + showLabel: true, + } ); + } } + > + paginationArrow !== 'none' } + label={ __( 'Pagination arrow' ) } + onDeselect={ () => + setAttributes( { paginationArrow: 'none' } ) + } + isShownByDefault + > + { - setAttributes( { showLabel: value } ); + setAttributes( { paginationArrow: value } ); } } /> + + { paginationArrow !== 'none' && ( + ! showLabel } + label={ __( 'Show text' ) } + onDeselect={ () => + setAttributes( { showLabel: true } ) + } + isShownByDefault + > + { + setAttributes( { showLabel: value } ); + } } + /> + ) } - + ) }