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

Query Loop: Add design enhancements for the "enhanced pagination" setting #54455

Merged
Merged
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. For enhanced pagination to work, remove the plugin block, then re-enable it in settings.'
luisherranz marked this conversation as resolved.
Show resolved Hide resolved
);

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 only works with the blocks bundled with WordPress. If you want to enable it, you have to remove all plugin blocks from the Query Loop.'
DAreRodz marked this conversation as resolved.
Show resolved Hide resolved
);

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;
}
14 changes: 12 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 All @@ -24,6 +24,16 @@
300ms
ease-in;
}

&.start-animation,
&.finish-animation {
@media (prefers-reduced-motion: reduce) {
DAreRodz marked this conversation as resolved.
Show resolved Hide resolved
transition-duration: 0s;
transition-delay: 0s;
animation-duration: 1ms;
animation-delay: 0s;
}
}
}

@keyframes wp-block-query__enhanced-pagination-start-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