Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to reference other components in SASS? #131

Closed
IntusFacultas opened this issue May 28, 2021 · 1 comment
Closed

Can't seem to reference other components in SASS? #131

IntusFacultas opened this issue May 28, 2021 · 1 comment

Comments

@IntusFacultas
Copy link

IntusFacultas commented May 28, 2021

Hi there, I was wondering if support for this feature in React styled-components will be implemented soon. In particular:

export const StyledButton = styled('button', props)`
  /** some styling here */
`;

export const ButtonGroup = styled.div`
  display: flex;
  ${StyledButton} + ${StyledButton} {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -2px;
  }
`;

Currently, doing this results in the following CSS being produced after compile for ButtonGroup:

    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    ): ;
    return resolvedAttrs: ;

which isn't valid. I know I can technically do

export const ButtonGroup = styled.div`
  display: flex;
  button + button {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-left: -2px;
  }
`;

But ideally I'd like to use the components so that the rendered css references a css rule both by element and the compiled hashed class name.

@IntusFacultas
Copy link
Author

Hi, I've realized this is a clone of #97 so I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant