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

Replace ad hoc badges with Badge component #68086

Conversation

prasadkarmalkar
Copy link
Contributor

What?

In this PR replacing ad hoc badges with Badge component
Issue URL - #68020

Why?

How?

  1. Exported Badge component.
  2. Replaced span with Badge component in block editor list view, site editor and inspector

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

  1. Site editor pages
Screenshot 2024-12-18 at 3 55 05 PM
  1. Inspector of editor
Screenshot 2024-12-18 at 3 55 59 PM
  1. Editor list view anchor
Screenshot 2024-12-18 at 3 56 04 PM

Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

Copy link

github-actions bot commented Dec 18, 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: prasadkarmalkar <[email protected]>
Co-authored-by: jameskoster <[email protected]>

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

@jameskoster
Copy link
Contributor

Thanks for working on this ❤️

One issue is that the current anchor 'badge' that we find in List View truncates to avoid taking over he entire row. Currently the Badge component doesn't support truncation creating a bit of a problem. Here's a comparison:

Trunk This PR
Screenshot 2024-12-18 at 13 13 00 Screenshot 2024-12-18 at 13 13 13

We could set a max-width, but the text will still overflow:

Screenshot 2024-12-18 at 13 16 02

My suggestion would be to tackle List View separately, after we've decided whether or not to add a truncate property to Badge.

@jameskoster jameskoster requested a review from a team December 18, 2024 13:17
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

This will currently throw errors as Badge import doesn't exist. See inline comment for more details.

@@ -7,6 +7,7 @@ import clsx from 'clsx';
* WordPress dependencies
*/
import {
Badge,
Copy link
Member

Choose a reason for hiding this comment

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

We currently don't expose Badge as a public component. You'll have to use the private API unlock mechanism to use it, see #68062 for a similar example.

@prasadkarmalkar
Copy link
Contributor Author

Thanks everyone for the review. Since an alternative PR has been created for the issue, I will close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants