EmotionContext version mismatch can break `styled.div(css({...`
See original GitHub issueDescribe the bug
The theme references in the import { css } from 'theme-ui'
function don’t work on version v0.5.0-alpha.0
It still works in the theme styles, variants, and
sx
prop.
To Reproduce
- Upgrade Theme UI to
v0.5.0-alpha.0
- Upgrade Emotion to v11
- Rename the emotion package names in you codebase
- Use the
css
function from theme-ui in an emotion component
export const StyledHeader = styled.div(
css({
// doesn't work
color: 'primary',
bg: 'background',
zIndex: 'nav',
maxWidth: 'sidebar',
borderRadius: 'small',
// works
px: 4,
})
)
This code outputs
.StyledHeader {
color: primary;
background-color: background;
z-index: nav;
max-width: sidebar;
border-radius: small;
padding-left: 32px;
padding-right: 32px;
}
Expected behavior Should output something like
.StyledHeader {
color: var(--theme-ui-colors-primary, #000000);
background-color: var(--theme-ui-colors-background, #ffffff);
z-index: 10;
max-width: 350px;
border-radius: 4px;
padding-left: 32px;
padding-right: 32px;
}
Screenshots
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Usage of Theme UI with TypeScript #834 - GitHub
Both theme variable and theme prop are typed as Theme . TBH I have no idea what could cause this, maybe except a...
Read more >emotional awareness scale: Topics by Science.gov
Our objective is to analyse the relationships that might exist between these states, the level of emotional awareness (capacity for the identification and ......
Read more >unconscious bias discriminatory - WorldWideScience
This talk will introduce the concept of unconscious bias and also give ... The results suggest that image is the only element able...
Read more >ACNP 56th Annual Meeting: Poster Session II, December 5 ...
can drive changes in affective behavior (i.e. increases anxiety- ... control in children with ADHD only vs. children with. ADHD+comorbidity vs.
Read more >(PDF) Speaker Verification Using Short Utterances with DNN ...
This discrepancy could be due to (1) acoustic. mismatch between the WashU-UCLA corpus and the speaker. verification corpora, and (2) only ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think you are right atm, not sure 100%, but who knows in he future. In any case I usually prefer transparent vs ease-of-use in the case of developers as users, assuming they can handle a few more steps. Maybe a good candidate for your polls 😃
Ignoring it isn’t so bad. People usually believe it’s their fault, because they didn’t “install properly”, but I think it’s a design flaw on our part. It’s too easy to break in userland.
Another idea:
We’re importing
@emotion/react
package.json to pass their version as EMOTION_VERSION through context. We could print a huge warning that something went wrong if the version we import doesn’t match (by semver) the version we depend on. Then, after we’ve shown a “disclaimer”, the responsibility is on the user.I’m not a huge fan of this solution, but it might be practical.