-
Notifications
You must be signed in to change notification settings - Fork 219
Interactivity API Collection Rating Filter #12020
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
assets/js/blocks/collection-filters/inner-blocks/rating-filter/block-wrapper.tsx
assets/js/blocks/collection-filters/inner-blocks/rating-filter/edit.tsx assets/js/blocks/collection-filters/inner-blocks/rating-filter/index.tsx |
Size Change: +19.8 kB (+1%) Total Size: 1.63 MB
ℹ️ View Unchanged
|
|
||
$selected_item = $ratings_array[0] ? array( | ||
/* translators: %d is referring to the average rating value */ | ||
'label' => sprintf( __( 'Rated %d out of 5', 'woo-gutenberg-products-block' ), $ratings_array[0] ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the MVP I have not supported rendering the HTML inside the dropdown because it requires some adjustments to the dropdown to properly support it (because right now we put the whole object in context it causes issues), so for this first pass I just have a text label and I will support HTML as a follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. I tested the PR and I can confirm it's working as expected. Great work!
Beside review comments, I have some suggestions:
- I think we should update the default
Collection Filters
block template to include this new block. - In the block folder, I can see you're breaking the edit component into
edit.tsx
andblock.tsx
like the current one. We don't render the block on client side now so I think we can put everything in theedit.tsx
component like others, what do you think?
assets/js/blocks/collection-filters/inner-blocks/rating-filter/block-wrapper.tsx
Show resolved
Hide resolved
assets/js/blocks/collection-filters/inner-blocks/rating-filter/block.json
Show resolved
Hide resolved
assets/js/blocks/collection-filters/inner-blocks/rating-filter/block.tsx
Show resolved
Hide resolved
Closing this as it isn't quite ready for merging and we are about to move across to the core monorepo. |
What / Why
This includes:
Testing Instructions
There are 2 modes for the rating, dropdown and checkbox list. You'll need to switch and test both types.
Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog