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

Icon: Support size prop for dashicons #43724

Closed
mirka opened this issue Aug 30, 2022 · 7 comments · Fixed by #45593
Closed

Icon: Support size prop for dashicons #43724

mirka opened this issue Aug 30, 2022 · 7 comments · Fixed by #45593
Labels
[Package] Components /packages/components

Comments

@mirka
Copy link
Member

mirka commented Aug 30, 2022

What problem does this address?

The size prop does not work when the icon is a dashicon string.

What is your proposed solution?

Add some handling (either to the Dashicon or the Icon component) so it adds a font-size style equivalent to the size.

@t-hamano
Copy link
Contributor

In the Icon component, if the size property is to be applied to the dashicon, does this mean that the default font size will be 24px instead of the current 20px?

Personally, I would expect the current default size (font size) to remain 20px when size prop is not specified in the dashicon. Developers still using the dashicon should expect the font size to remain 20px unless they explicitly specify otherwise.
If we plan to deprecate the dashicon as you mention in #43725, how about keeping the default size?

I believe the direction of this issue will help move #43574 forward 🙂
What do you think?

@mirka
Copy link
Member Author

mirka commented Aug 31, 2022

If we plan to deprecate the dashicon as you mention in #43725, how about keeping the default size?

Yes, if it's agreed that dashicons can be deprecated, there's probably no good reason to add a "new feature" (even if it's kind of a bug fix) like customizable sizes. So if we're going to deprecate, I think keeping the current 20px size is reasonable 👍

I just wasn't sure if there would be pushback on deprecating dashicons, since I hear it's widely used by the community 😅 At least, the contributors to this repo generally seem to agree that it can/should be deprecated.

(cc @ciampo for visibility)

@ciampo
Copy link
Contributor

ciampo commented Aug 31, 2022

My preferred option would be to deprecate dashicons (ie. to simplify rather than add more complexity), but we should definitely check with the project leads if this something that we can do.

@t-hamano
Copy link
Contributor

t-hamano commented Sep 6, 2022

I would like to address this problem, but first I think it would be a good idea to rewrite the test from Enzyme to React Testing Library to clarify the current specifications.
Does this make sense?

@ciampo
Copy link
Contributor

ciampo commented Sep 6, 2022

rewrite the test from Enzyme to React Testing Library to clarify the current specifications.

That would always be a good idea, as we're in the process of migrating from Enzyme to RTL for the whole repo :)

@t-hamano
Copy link
Contributor

t-hamano commented Sep 6, 2022

Thank you! I'll work on refactoring the test first.

@t-hamano
Copy link
Contributor

I have submitted a PR regarding the refactoring of tests: #44051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants