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

Refactor/toolbar item component to typescript #49190

Merged
merged 7 commits into from
May 2, 2023
Merged

Refactor/toolbar item component to typescript #49190

merged 7 commits into from
May 2, 2023

Conversation

margolisj
Copy link
Contributor

@margolisj margolisj commented Mar 20, 2023

What?

Convert the ToolbarItem component to TypeScript.

Why?

This PR is needed as part of an effort to convert ToolbarItem to TypeScript. As mentioned in #35744 .

How?

By adding types to ToolbarItem.

Testing Instructions

Create or otherwise open a post
Add a block that would have some toolbar controls (e.g. Image)
Expected: Toolbar buttons should fundamentally work the same as before:

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

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @margolisj! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

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

@margolisj
Copy link
Contributor Author

@mike-day hey I just saw in another thread you were going to start more Toolbar related typings and just wanted to let you know I started this and ToolbarGroup. Sry for the @ couldn't think of a better way to send a message to you.

@margolisj margolisj closed this Mar 21, 2023
@margolisj margolisj reopened this Mar 21, 2023
@mike-day
Copy link
Contributor

Thanks for the heads up, @margolisj!

@skorasaurus skorasaurus added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Mar 26, 2023
@mirka mirka added this to In progress (owned) ⏳ in WordPress Components via automation Apr 11, 2023
@mirka mirka requested review from mirka and ciampo April 11, 2023 10:08
Copy link
Member

@mirka mirka 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 contributing, @margolisj! If you ever do any more of these, feel free to ping me and @ciampo on the PR so we can get it reviewed in a more timely manner 😄

Before we merge, it'll be great if you could rebase and add a changelog entry as well, thanks.

packages/components/src/toolbar/toolbar-item/index.tsx Outdated Show resolved Hide resolved
packages/components/src/toolbar/toolbar-item/index.tsx Outdated Show resolved Hide resolved
packages/components/src/toolbar/toolbar-item/index.tsx Outdated Show resolved Hide resolved
packages/components/src/toolbar/toolbar-item/types.ts Outdated Show resolved Hide resolved
packages/components/src/toolbar/toolbar-item/index.tsx Outdated Show resolved Hide resolved
@margolisj
Copy link
Contributor Author

@mirka I'll be able to respond to your comments and possibly fix them, time permitting, but I also did ToolBarGroup. Would you like me to pull that into this and make it a larger PR or leave this here and open another on top of this?

@mirka
Copy link
Member

mirka commented Apr 19, 2023

@mirka I'll be able to respond to your comments and possibly fix them, time permitting, but I also did ToolBarGroup. Would you like me to pull that into this and make it a larger PR or leave this here and open another on top of this?

Great, thank you! Let's make it a separate PR for easier review 👍

@margolisj
Copy link
Contributor Author

@mirka + @ciampo Looks like there is a unit test using the function based toolbar item line 85 toolbar/stores/index.tsx:

{
		children,
		as: Component,
		...props
}: React.ComponentPropsWithoutRef< typeof BaseToolbarItem >

I added a ts-ignore to that. Another issue from that causes as/Component parameter to default to (parameter) Component: "button" | undefined.

@mirka mirka self-requested a review April 24, 2023 18:59
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Looks great, thank you for your work on this! 🚀

We can merge once the changelog conflict is resolved.

@margolisj
Copy link
Contributor Author

@mirka @ciampo Changelog resolved and rest of comments resolved. let me know if there is anything else. Once this is merged I'll rebased / rewrite the ToolbarGroup to use this instead of the stubs I have.

@mirka mirka enabled auto-merge (squash) April 28, 2023 15:56
@mirka mirka merged commit dd53e35 into WordPress:trunk May 2, 2023
49 checks passed
WordPress Components automation moved this from In progress (owned) ⏳ to Done 🎉 May 2, 2023
@github-actions
Copy link

github-actions bot commented May 2, 2023

Congratulations on your first merged pull request, @margolisj! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 15.8 milestone May 2, 2023
@margolisj margolisj deleted the refactor/ToolbarItem branch May 7, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
4 participants