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

Commit 0eaad36

Browse files
committed
fix(emotion): fix .extend behaviour using emotion
Closes #29
1 parent 6670996 commit 0eaad36

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

β€Ždocs/advanced/ExtendStyles.mdxβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ An example of a `BorderedButton` extended from a `Button`:
6161
border-color: blue;
6262
}
6363
`
64+
6465
return (
6566
<BorderedButton variant="primary">
6667
A button with border !

β€Žsrc/styled-engine/emotion.jsβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ export const patchStyledAPI = (StyledComponent, BaseComponent) => {
5353
Object.defineProperty(StyledComponent, 'extend', {
5454
get() {
5555
return (...args) => {
56-
const NewStyledComponent = styled(StyledComponent)(...args)
56+
const NewStyledComponent = styled(StyledComponent)`
57+
&&& {
58+
${css(...args)};
59+
}
60+
`
5761
patchStyledAPI(NewStyledComponent, StyledComponent)
5862
return NewStyledComponent
5963
}

β€Žsrc/utils/createComponent.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function createComponent(getConfig) {
1717
render = ({ Component, ...props }) => <Component {...props} />,
1818
defaultComponent = 'div',
1919
system = allSystem,
20-
applySystem = system => props => ({ '&&&': system(props) }),
20+
applySystem = system => props => ({ '&&&&': system(props) }),
2121
injectTheme,
2222
InnerComponent: InnerComponentFromConfig,
2323
} = getConfig()

0 commit comments

Comments
Β (0)