-
Notifications
You must be signed in to change notification settings - Fork 262
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
Feature/dynamic elements #462
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you this looks great! You will have to update the snapshots with ava -u
src/babel.js
Outdated
Object.values(path.scope.bindings).some(binding => | ||
binding.referencePaths.some(r => r === tag) | ||
) || | ||
(attributes && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this feature for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, if we want to add it at a later point let me know
@@ -34,6 +36,9 @@ export default () => ( | |||
<div {...props} {...rest} /> | |||
<div {...props} data-foo {...rest} /> | |||
<div {...props} className={'test'} data-foo {...rest} /> | |||
<Element styled-jsx /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't want to include this feature here for now, let's fix one thing at the time
`}</style> | ||
</Element> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome can you add a few more tests cases? i.e. a few more combinations to where Element
is defined outside of the component, and maybe when it is lowercase too (any edge case you can think of). Also can you add a class component too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Im missing something, but I dont think it will work if Element is defined outside of the component. ( Thats why I added the styled-jsx option )
I´ll add the testcases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, it won't work (it won't add the className) and we want a snapshot of that! ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Removed support for styled-jsx attribute matching
@twltwl this branch is good to merge, can you just remove node |
@twltwl thanks so much for this great contribution! 🙌 |
@giuseppeg I cannot use this feature for some reason. Babel is not stripping out the |
Related issue #147
Based on comment by @giuseppeg
Automaticly scopes elements if possible ( works if declared inside of component )
for other cases a styled-jsx prop can be added