Hide list controls when no items are selected (#40434)

* The Select all and Clear selection buttons are only displayed when at least 1 item is selected

* Add changelog file
This commit is contained in:
Maikel David Pérez Gómez 2023-09-28 09:14:48 -04:00 committed by GitHub
parent e65c5dbef4
commit d8aa52d0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 14 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
The Select all and Clear selection buttons are only displayed when at least 1 item is selected

View File

@ -349,20 +349,24 @@ export const VariationsTable = forwardRef<
/>
</div>
<div className="woocommerce-product-variations__filters">
{ hasSelection( variationIds ) && (
<>
<Button
variant="tertiary"
disabled={ areAllSelected( variationIds ) }
onClick={ () => onSelectAll( variationIds )( true ) }
onClick={ () =>
onSelectAll( variationIds )( true )
}
>
{ __( 'Select all', 'woocommerce' ) }
</Button>
<Button
variant="tertiary"
disabled={ ! hasSelection( variationIds ) }
onClick={ () => onClearSelection() }
onClick={ onClearSelection }
>
{ __( 'Clear selection', 'woocommerce' ) }
</Button>
</>
) }
</div>
<div>
<VariationsActionsMenu