-
Notifications
You must be signed in to change notification settings - Fork 34
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
Move and adjust ratings-bars and ratings-stars. #633
Conversation
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.
The blocks do work, but I have some feedback on the filter process. In the query total & query filter blocks, the filter runs over a placeholder value so the filter only applies to that item, I think an approach like that would be better here.
Co-authored-by: Kelly Dwan <ryelle@users.noreply.github.com>
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.
Looks good now, one last little 🧹 cleanup request before merging — the attributes can be removed from block.json
.
See WordPress/wporg-mu-plugins#633 Co-authored-by: Kelly Dwan <ryelle@users.noreply.github.com>
We have ratings components on wp.org in there places:
This PR moves blocks added to https://github.com/WordPress/wporg-theme-directory to this project for use across the site.
Approach
I decided to use block.json to expose the attributes and custom filters for themes to use to populate the values. I'm not 100% sure it's the best approach. I considered using render_block_data instead of a custom filter but thought this was more maintainable in the future and we use custom filters for other blocks. I can be convinced otherwise.
Example Usage
wporg/ratings-stars
Attributes
wporg/ratings-bars
Attributes
ratings
Filter Example
Testing this PR
You can test this PR in conjunction with WordPress/wporg-theme-directory#146.
That environment doesn't include the
ratings
table by default so it make makes sense to test in a sandbox.