Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
fix(emotion): fix .extend behaviour using emotion
Browse files Browse the repository at this point in the history
Closes #29
  • Loading branch information
gregberge committed Sep 8, 2018
1 parent 6670996 commit 0eaad36
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/advanced/ExtendStyles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ An example of a `BorderedButton` extended from a `Button`:
border-color: blue;
}
`

return (
<BorderedButton variant="primary">
A button with border !
Expand Down
6 changes: 5 additions & 1 deletion src/styled-engine/emotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export const patchStyledAPI = (StyledComponent, BaseComponent) => {
Object.defineProperty(StyledComponent, 'extend', {
get() {
return (...args) => {
const NewStyledComponent = styled(StyledComponent)(...args)
const NewStyledComponent = styled(StyledComponent)`
&&& {
${css(...args)};
}
`
patchStyledAPI(NewStyledComponent, StyledComponent)
return NewStyledComponent
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/createComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function createComponent(getConfig) {
render = ({ Component, ...props }) => <Component {...props} />,
defaultComponent = 'div',
system = allSystem,
applySystem = system => props => ({ '&&&': system(props) }),
applySystem = system => props => ({ '&&&&': system(props) }),
injectTheme,
InnerComponent: InnerComponentFromConfig,
} = getConfig()
Expand Down

0 comments on commit 0eaad36

Please sign in to comment.