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

Return negative number from lookup if theme value is a number #1665

Merged
merged 2 commits into from
Apr 21, 2021

Conversation

kenny-f
Copy link
Contributor

@kenny-f kenny-f commented Apr 21, 2021

On a previous pull request #865 I added the feature to allow negative lookups of theme objects to be resolved.

eg:
given { space: { s: '8px' } and sx={{ margin: '-s' }} would be resolved to margin: '-8px'

however when the theme value is a number it resolves to '-8' (string) instead of -8 (number) and then in the browser you see margin: -80 instead of margin: -80px

This pr will fix this by checking if the theme value type is a number, and if it is will return a number.

@kenny-f kenny-f requested a review from hasparus as a code owner April 21, 2021 14:00
@vercel
Copy link

vercel bot commented Apr 21, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/systemui/theme-ui/Ca7gEpVkfVcGGcqFgbrTJzqTJ6xk
✅ Preview: https://theme-ui-git-fork-kenny-f-fix-negative-number-lookup-systemui.vercel.app

Copy link
Contributor

@dios-david dios-david left a comment

Choose a reason for hiding this comment

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

Nice catch!

Copy link
Member

@lachlanjc lachlanjc left a comment

Choose a reason for hiding this comment

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

Appreciated!

@hasparus
Copy link
Member

Solid PR @kenny-f! Thanks!

@hasparus hasparus merged commit f7706bc into system-ui:develop Apr 21, 2021
@hasparus hasparus added the patch Increment the patch version when merged label Apr 21, 2021
@hasparus
Copy link
Member

Released with 0.7.3

@hasparus hasparus added the released This issue/pull request has been released. label Apr 21, 2021
@kenny-f
Copy link
Contributor Author

kenny-f commented Apr 22, 2021

Released with 0.7.3

@hasparus Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants