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

Interpolating functions in css calls #1871

Closed
josephmarkus opened this issue May 15, 2020 · 1 comment
Closed

Interpolating functions in css calls #1871

josephmarkus opened this issue May 15, 2020 · 1 comment
Labels

Comments

@josephmarkus
Copy link
Contributor

I would like to use a helper function for media queries that essentially wraps my CSS.

My problem is when this function attempts to style based on props.

Although I know that styled-components has only been a source of inspiration for emotion, I have a working example here: https://codesandbox.io/s/breakpoints-styled-components-64yox?file=/src/App.js

Equivalent of that in Emotion throws an error: https://codesandbox.io/s/breakpoints-emotion-js-nf58w?file=/src/App.js

I saw this suggested solution here - #1085 (comment) - but I'm unsure how to correctly apply this when my styles can have generic conditionals inside them.

Note that the example uses Emotion v9

Any help would be much appreciated 🙏

@Andarist
Copy link
Member

A working solution for Emotion 9: https://codesandbox.io/s/breakpoints-emotion-js-umbcd?file=/src/App.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants