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

Grid gap property not reading theme space values #1857

Closed
sergeylukin opened this issue Jul 5, 2021 · 8 comments
Closed

Grid gap property not reading theme space values #1857

sergeylukin opened this issue Jul 5, 2021 · 8 comments
Labels
bug Something isn't working context-version-mismatch

Comments

@sergeylukin
Copy link

Describe the bug

Hi, <Grid /> gap property doesn't respect spaces from connected theme while sx does.

To Reproduce
Steps to reproduce the behavior:

  1. Setup basic example with theme:
const theme = {
    space: [0, 2, 4, 8, 12, 16, 20, 24, 32, 64, 128, 256, 512],
   ...
}

Expected behavior

<Grid gap={2} /> resulting in grid with gap of 4px

@hasparus hasparus added the bug Something isn't working label Jul 5, 2021
@hasparus
Copy link
Member

hasparus commented Jul 5, 2021

Hey @sergeylukin, do you maybe have a reproduction repo or CodeSandbox? It seems to work in the docs.

image

What versions of Theme UI and Emotion do you have? Are you maybe using Theme UI inside of Storybook?

@lachlanjc
Copy link
Member

lachlanjc commented Jul 5, 2021

Fwiw, this works fine for me! So more likely a setup issue.

@hasparus
Copy link
Member

hasparus commented Jul 5, 2021

The problem might be caused by context version mismatch (and serve as another reason for us to move Emotion to peerDeps), so I'd look for the cause in package.json.

@sergeylukin
Copy link
Author

Will export my setup to codesandox during today-tomorrow and provide a proof or will prove myself wrong, thank you @lachlanjc @hasparus !

@sergeylukin
Copy link
Author

sergeylukin commented Jul 6, 2021

@hasparus you're right, I found 2 versions of @emotion/react in my yarn.lock (I'm using 11.4.0 while theme-ui is using 11.1.1):

Screen Shot 2021-07-06 at 19 43 18

...because I've used @emotion/react internals in my project. What's the solution as long as I do want to use @emotion/react in my project? Is it just aligning the version of @emotion/react to the one used by current theme-ui?

@lachlanjc
Copy link
Member

Check this out! #1531 (comment) There's some other issues with that label with more conversations as well.

@hasparus
Copy link
Member

hasparus commented Jul 7, 2021

@sergeylukin, you can either use yarn resolutions to enforce the new Emotion version on Theme UI or downgrade yours (does 11.4 have anything new you're using)?

We're definitely moving Emotion to peerDeps in next bigger release, @lachlanjc :/

@sergeylukin
Copy link
Author

@hasparus makes sense, thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working context-version-mismatch
Projects
None yet
Development

No branches or pull requests

3 participants