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

Setting "as" on an extended styled component removes the existing styles #388

Closed
Adam-Collier opened this issue Nov 12, 2021 · 3 comments · Fixed by #392
Closed

Setting "as" on an extended styled component removes the existing styles #388

Adam-Collier opened this issue Nov 12, 2021 · 3 comments · Fixed by #392
Labels
bug Something isn't working

Comments

@Adam-Collier
Copy link

Adam-Collier commented Nov 12, 2021

Came across this issue when I wanted to extend a Stack component (which is a styled component) and change it to a different tag, only to find that the base styles that were supposed to be extended were removed.

You can try it out for yourself here:
https://stackblitz.com/edit/nextjs-yrwh2y?file=pages%2Findex.js

the "as" value is currently set to "section" and you can see there is no gap between the items. Once you remove the "as" it works as it should (but with the wrong tag). I'd have thought we would still be able to use the "as" prop when extending an existing styled component, so thought I would bring it up

@cristianbote cristianbote added the bug Something isn't working label Nov 15, 2021
@cristianbote
Copy link
Owner

Hey @Adam-Collier, looking into it. Thanks for reporting!

@cristianbote
Copy link
Owner

Hey @Adam-Collier sorry for being MIA but took another look and it seems that you fixed it by having a wrapper defined and passing as prop to it?

@Adam-Collier
Copy link
Author

Hey @cristianbote no need to apologise! Amazing stuff getting a fix out there, perfect timing too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants