Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for passing theme to functions in array css prop (#1130)
* Added support passing theme to functions in array css prop * Add changeset * Adjust how arrays passed to css prop are transformed so function elements can be resolved at runtime * Match Global's styles prop to css prop behavior * Update snapshots
- Loading branch information
Showing
17 changed files
with
273 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'babel-plugin-emotion': minor | ||
'@emotion/babel-preset-css-prop': minor | ||
--- | ||
|
||
Adjust how arrays passed to css prop are transformed so function elements can be resolved at runtime. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@emotion/core': minor | ||
--- | ||
|
||
Support functions in arrays passed to css prop and Global's styles prop. This allows for composition of theme-accepting functions. |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-emotion/__tests__/__fixtures__/css-prop-complex-array.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** @jsx jsx */ | ||
import { jsx, Global } from '@emotion/core/macro' | ||
|
||
const css1 = theme => ({ backgroundColor: theme.bgColor }) | ||
const css2 = theme => ({ padding: theme.spacing.small }) | ||
|
||
function SomeComponent(props) { | ||
return <div css={[css1, css2]}>{'Emotion'}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.