Skip to content

Commit

Permalink
extend connectStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
sstimac committed Jul 26, 2017
1 parent f9a20f1 commit 180156f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -6,3 +6,6 @@ node_modules/

# WebStorm
.idea

# Mac OS X folder attributes file
.DS_Store
8 changes: 8 additions & 0 deletions src/connectStyle.js
Expand Up @@ -49,6 +49,13 @@ export default (componentStyleName, componentStyle = {}, mapPropsToStyleNames, o
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}

function getBaseComponent(WrappedComponent) {
if (WrappedComponent.BaseComponent) {
return WrappedComponent.BaseComponent;
}
return WrappedComponent;
}

return function wrapWithStyledComponent(WrappedComponent) {
const componentDisplayName = getComponentDisplayName(WrappedComponent);

Expand Down Expand Up @@ -99,6 +106,7 @@ export default (componentStyleName, componentStyle = {}, mapPropsToStyleNames, o

static displayName = `Styled(${componentDisplayName})`;
static WrappedComponent = WrappedComponent;
static BaseComponent = getBaseComponent(WrappedComponent);

constructor(props, context) {
super(props, context);
Expand Down

0 comments on commit 180156f

Please sign in to comment.