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

Page List: Added color support #66430

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

benazeer-ben
Copy link
Contributor

@benazeer-ben benazeer-ben commented Oct 24, 2024

What?

Add color support to the Page List block.
Part of #43245

Why?

Page List block is missing color support.

How?

Adds the color support via block.json

Testing Instructions

  • Go to the Global Styles setting ( under appearance > editor > styles > edit styles > blocks ).
  • Make sure that the Page List block's color is configurable via Global Styles.
  • Verify that Global Styles are applied correctly in the editor and frontend.
  • Edit the template/page, add Page List block and apply the color for background and links.
  • Verify that block color styles take precedence over global block colour settings.
  • Verify that block color display correctly in both the editor and frontend.

Screenshots or screencast

Backend:
pagelistcolorbackend

Frontend:
pagelistcolorfrontend

Copy link

github-actions bot commented Oct 24, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: benazeer-ben <benazeer@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Oct 24, 2024
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @benazeer-ben! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@akasunil akasunil added [Type] Enhancement A suggestion for improvement. [Block] Page List Affects the Page List Block labels Oct 25, 2024
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @benazeer-ben 👍

This is working as advertised.

✅ Global Styles apply correctly in the editor and the frontend
✅ Block support styles override global styles in both editor and frontend

I see you chose to explicitly omit text color support. This might actually be good to add too.

If a link color hasn't been set, applying a text color will automatically set the matching link color. This would allow the page list's bullets to be updated to match link color or differ as the theme author or use might wish.

What do you think?

Without Text Support With Text Support
Screenshot 2024-11-11 at 5 45 28 pm Screenshot 2024-11-11 at 5 45 10 pm

@benazeer-ben
Copy link
Contributor Author

Thanks for the suggestion @aaronrobertshaw

Yes, you are right. If the text support added then we can use it as optional if we need. Otherwise we can just keep the link colour.

I have added text support in the recent commit.

adding default controls

Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
@benazeer-ben
Copy link
Contributor Author

@aaronrobertshaw Please let me know if it need more tweaks on this.

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

This is looking good @benazeer-ben

✅ Global styles apply correctly on frontend and in editor
✅ Block support styles override global styles appropriately
✅ Default controls exposed follow convention for color supports

Editor:
Screenshot 2024-11-18 at 6 16 20 pm

Frontend:
Screenshot 2024-11-18 at 6 16 31 pm

Note: For anyone else testing, there's a known issue where a gradient global style would override block instance's background color. That's due to the use of background vs background-color in those styles and isn't introduced here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Page List Affects the Page List Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants