Add ability to document typesets in different units
See original GitHub issueIs your feature request related to a problem? Please describe.
We using rem units in our typography and would like to document it with addon-docs. Right now Typeset component accepts numbers in pixels to show those sizes. If we provide rem units, it works correctly, except for size itself - it shows rempx
Describe the solution you’d like
It would be great to accept not only numbers, but strings with units. Since it already works, it should take single isNaN
check to determine if it should append px
or leave as is. Also types should be changed.
Describe alternatives you’ve considered We can make our own component for Typesets, if you not willing to accept this proposal
Are you able to assist bring the feature to reality? yes, I can… I just need guidance on codebase and tests.
Additional context
This code:
<Typeset fontSizes={[16, '1rem']} />
Gives us this result:
And this is almost desirable result
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Yippee!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-alpha.30 containing PR #8574 that references this issue. Upgrade today to try it out!
You can find this prerelease on the
@next
NPM tag.Closing this issue. Please re-open if you think there’s still more to do.
Absolutely, definitely open to a PR!
On Fri, Oct 25, 2019 at 12:45 PM Kirill Popolov notifications@github.com wrote: