Templarian / MaterialDesign-React

Dist for Material Design Icons React Component for JS/TypeScript
https://materialdesignicons.com
MIT License
142 stars 20 forks source link

icon size #10

Closed fibo closed 6 years ago

fibo commented 6 years ago

Hi, why the icon size is multiplied by 1.5 ?

I refer to this snippet:

  const width = typeof size === "string" ? size : `${size * 1.5}rem`;

I am wrapping @mdi/react icon to add isSmall, isLarge props: I expected that size would be passed as is.

Templarian commented 6 years ago

@fibo We make the assumption that most users use a base rem size of 16px. 16 * 1.5 = 24px the native 1:1 size for people on older screens this should look best.

You can also pass a string to the size. So you could put any value you want. size={'1.5em'} for example.

Hopefully that reasoning makes sense. It's mostly to accommodate 95% of users, but allows the 5% to use a string.

Templarian commented 6 years ago

So in your wrapper, simply put size={`${size}rem`}, is what I mean.

Templarian commented 6 years ago

Chatting with the team about this, we're going to remove the default setting of 1 and make it unset.

Small breaking change for existing users, but probably best to handle this in CSS.

Templarian commented 6 years ago

Okay, we've decided to bundle this breaking change into v1.0.0 along side the release of <Stack/> component that will be bundled with <Icon/>.

fibo commented 6 years ago

Thanks for the answer and support, I also opted for passing a string.

Templarian commented 6 years ago

Since you're passing a string it will continue to work the same after the changes go out for v1.0.0. Your feedback along with 2 others convinced me we should change the default functionality in the final release, so thanks!

Templarian commented 6 years ago

@fibo By the way v1.0.0 released with this change (and lots of other updates). 😺

fibo commented 6 years ago

@Templarian thanks, I am going to check it out. I will probably using your package in production at my new job, just in few minutes I am going to discuss about some proposal and among many others there will be this package.

Ahah I was like cause it was what I was looking for and it was just created, I putted like the fifth star on GitHub.

Thanks for sharing your software and for your passion, I hope you can find useful some packages I shared or at least I will try to contribute with feedbacks and maybe PRs.

Have a nice day, Gianluca.