-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix issue with cx not being able to compose opaque styles #1802
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
Conversation
🦋 Changeset is good to goLatest commit: 74db10f We got this. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 74db10f:
|
311b2ac
to
c3d5beb
Compare
Codecov Report
|
c3d5beb
to
74db10f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I agree with this change. cx
is meant to compose together class names and the return value of @emotion/react
's css function is not a class name
In such a case the documentation should be tweaked because right now it states:
And while it is true to some extent this is surprising that it was not able to compose regular React styles (so not exactly the same like in previous versions, people dont tend to think about those things as "string styles" and "opaque styles", conceptually they are just "styles"). The use case like this seems valid: import { css } from `@emotion/react`
;<ClassNames>
{({ cx }) => <div className={cx(css`color:hotpink;`, 'other-cls')} />}
</ClassNames> This can be "fixed" by calling received At the very least we could introduce a dev warning telling people what to do if they misuse the API. |
This sounds good to me. |
Closed in favor of #1810 |
closes #1769