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

Support jsx pragma for custom components #21

Closed
nandorojo opened this issue Aug 5, 2020 · 10 comments
Closed

Support jsx pragma for custom components #21

nandorojo opened this issue Aug 5, 2020 · 10 comments

Comments

@nandorojo
Copy link
Owner

I think I know how this could work, but I have to look into the theme ui code to be sure.

The hurdle is that we need to hook into the component, not just pass a raw className prop.

@nandorojo
Copy link
Owner Author

nandorojo commented Aug 5, 2020

https://github.com/emotion-js/emotion/blob/master/packages/babel-plugin-jsx-pragmatic/src/index.js

Babel plugin could be cool too.

@cmaycumber
Copy link
Contributor

This would be a cool feature. I can definitely try to help with this.

I'm not 100% sure how the theme-ui-native repo did it but it seemed like it just wrapped the components with a ThemeProvider. There's was working last time a played around with that repo not sure if that strategy would work for dripsy but it might be worth a shot looking at it.

@nandorojo
Copy link
Owner Author

All we would really need to do is wrap the function with createThemedComponent. If that's possible, this should be pretty smooth.

@cmaycumber
Copy link
Contributor

That seems like the move.

On another note is it possible to remove styled-components as a dependency now that we have fresnel? Emotion seems like it's doing most of the heavy lifting style wise as a dependency to theme-ui.

@nandorojo
Copy link
Owner Author

@nandorojo
Copy link
Owner Author

On another note is it possible to remove styled-components as a dependency now that we have fresnel? Emotion seems like it's doing most of the heavy lifting style wise as a dependency to theme-ui.

Yeah, I believe I removed that as a dependency in the fresnel branch, but if I forgot, let's get rid of that.

@nandorojo
Copy link
Owner Author

@cmaycumber
Copy link
Contributor

I'll try to get a PR for this created with in the next day or two. I think it should be relatively simple. I'll also take a look through that typescript article you sent over.

@nandorojo
Copy link
Owner Author

That's great!

I believe the TS article helps with the Fragment. Not sure if you've run into this with theme-ui, but its pragma doesn't let you use <> React fragments which is a pain.

@cmaycumber
Copy link
Contributor

Yeah, I have it's a pain.

@cmaycumber cmaycumber mentioned this issue Aug 29, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants