Skip to content

Commit

Permalink
Query Loop: Add design enhancements for the "enhanced pagination" set…
Browse files Browse the repository at this point in the history
…ting (#54455)

* Update modal texts

* Update enhanced pagination error notice text

* Remove notice margin

* Update modal classname

* Update modal spacing

* Update animation time

* Change delay from 300 to 400 ms

* Disable animation motion when preferred

* Clarify that plugin blocks could be supported in the future

Co-authored-by: Luis Herranz <luisherranz@gmail.com>

* Clarify that plugin blocks are not supported yet but will be

Co-authored-by: Luis Herranz <luisherranz@gmail.com>

* Mention enhanced pagination again

* Fix eslint error

* Update modal description to mention the Query block

* Revert "Disable animation motion when preferred"

This reverts commit fe52845.

---------

Co-authored-by: Luis Herranz <luisherranz@gmail.com>
  • Loading branch information
DAreRodz and luisherranz authored Sep 15, 2023
1 parent 8da8987 commit 45f5608
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useState, useEffect } from '@wordpress/element';
import { useContainsThirdPartyBlocks } from '../utils';

const disableEnhancedPaginationDescription = __(
'Third-party blocks are not supported inside a Query Loop block with enhanced pagination enabled. To re-enable it, remove any third-party block and then update it in the Query Loop settings.'
'Plugin blocks are not supported yet. For the enhanced pagination to work, remove the plugin block, then re-enable "Enhanced pagination" in the Query Block settings.'
);

const modalDescriptionId =
Expand All @@ -38,15 +38,15 @@ export default function EnhancedPaginationModal( {
isOpen && (
<Modal
title={ __( 'Enhanced pagination will be disabled' ) }
className={ 'wp-block-query-enhanced-pagination-modal' }
className="wp-block-query__enhanced-pagination-modal"
aria={ {
describedby: modalDescriptionId,
} }
isDismissible={ false }
shouldCloseOnEsc={ false }
shouldCloseOnClickOutside={ false }
>
<VStack alignment="right" spacing={ 8 }>
<VStack alignment="right" spacing={ 5 }>
<span id={ modalDescriptionId }>
{ disableEnhancedPaginationDescription }
</span>
Expand All @@ -56,7 +56,7 @@ export default function EnhancedPaginationModal( {
setAttributes( { enhancedPagination: false } );
} }
>
{ __( 'OK, understood' ) }
{ __( 'OK' ) }
</Button>
</VStack>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function EnhancedPaginationControl( {
clientId,
} ) {
const enhancedPaginationNotice = __(
'Enhanced pagination requires all descendants to be Core blocks. If you want to enable it, you have to remove all third-party blocks contained inside the Query Loop block.'
"Enhanced pagination doesn't support plugin blocks yet. If you want to enable it, you have to remove all plugin blocks from the Query Loop."
);

const containsThirdPartyBlocks = useContainsThirdPartyBlocks( clientId );
Expand All @@ -36,11 +36,13 @@ export default function EnhancedPaginationControl( {
} }
/>
{ containsThirdPartyBlocks && (
<div>
<Notice status="warning" isDismissible={ false }>
{ enhancedPaginationNotice }
</Notice>
</div>
<Notice
status="warning"
isDismissible={ false }
className="wp-block-query__enhanced-pagination-notice"
>
{ enhancedPaginationNotice }
</Notice>
) }
</>
);
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/query/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@
}
}

.wp-block-query-enhanced-pagination-modal {
.wp-block-query__enhanced-pagination-modal {
@include break-small() {
max-width: $break-mobile;
}
}

.wp-block-query__enhanced-pagination-notice {
margin: 0;
}
4 changes: 2 additions & 2 deletions packages/block-library/src/query/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
animation:
wp-block-query__enhanced-pagination-start-animation
30s
cubic-bezier(0, 1, 0, 1)
infinite;
cubic-bezier(0.03, 0.5, 0, 1)
forwards;
}

&.finish-animation {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/query/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ store( {
context.core.query.message =
context.core.query.loadingText;
context.core.query.animation = 'start';
}, 300 );
}, 400 );

await navigate( ref.href );

Expand Down

1 comment on commit 45f5608

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 45f5608.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6198085757
📝 Reported issues:

Please sign in to comment.