From 87c84f5946b4af105fc8ecc894712bb7469a77e4 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Thu, 26 Dec 2024 12:32:40 +0900 Subject: [PATCH] Query Total: Remove nested element --- .../block-library/src/query-total/edit.js | 24 +++++++++---------- .../block-library/src/query-total/index.php | 11 +++------ 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/packages/block-library/src/query-total/edit.js b/packages/block-library/src/query-total/edit.js index 4824021ae99b0..d91a199071572 100644 --- a/packages/block-library/src/query-total/edit.js +++ b/packages/block-library/src/query-total/edit.js @@ -48,27 +48,25 @@ export default function QueryTotalEdit( { attributes, setAttributes } ) { // Controls for the block. const controls = ( - <> - - - - - - + + + + + ); // Render output based on the selected display type. const renderDisplay = () => { if ( displayType === 'total-results' ) { - return
{ __( '12 results found' ) }
; + return <>{ __( '12 results found' ) }; } if ( displayType === 'range-display' ) { - return
{ __( 'Displaying 1 – 10 of 12' ) }
; + return <>{ __( 'Displaying 1 – 10 of 12' ) }; } return null; diff --git a/packages/block-library/src/query-total/index.php b/packages/block-library/src/query-total/index.php index c78d0498f634f..ff2ac486727b9 100644 --- a/packages/block-library/src/query-total/index.php +++ b/packages/block-library/src/query-total/index.php @@ -40,14 +40,14 @@ function render_block_core_query_total( $attributes, $content, $block ) { switch ( $attributes['displayType'] ) { case 'range-display': if ( $start === $end ) { - $range_text = sprintf( + $output = sprintf( /* translators: 1: Start index of posts, 2: Total number of posts */ __( 'Displaying %1$s of %2$s' ), $start, $max_rows ); } else { - $range_text = sprintf( + $output = sprintf( /* translators: 1: Start index of posts, 2: End index of posts, 3: Total number of posts */ __( 'Displaying %1$s – %2$s of %3$s' ), $start, @@ -56,17 +56,12 @@ function render_block_core_query_total( $attributes, $content, $block ) { ); } - $output = sprintf( '

%s

', $range_text ); break; case 'total-results': default: // translators: %d: number of results. - $total_text = sprintf( _n( '%d result found', '%d results found', $max_rows ), $max_rows ); - $output = sprintf( - '

%s

', - $total_text - ); + $output = sprintf( _n( '%d result found', '%d results found', $max_rows ), $max_rows ); break; }