-
Notifications
You must be signed in to change notification settings - Fork 264
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const Element = 'div' | ||
|
||
export default () => ( | ||
<div> | ||
<div className="test" {...test.test} /> | ||
|
@@ -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 commentThe 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 |
||
<Element styled-jsx className="test" /> | ||
<Element styled-jsx {...props} /> | ||
<style jsx>{'div { color: red }'}</style> | ||
</div> | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default ({ level = 1 }) => { | ||
const Element = `h${level}` | ||
|
||
return ( | ||
<Element className="root"> | ||
<p>dynamic element</p> | ||
<style jsx>{` | ||
.root { | ||
background: red; | ||
} | ||
`}</style> | ||
</Element> | ||
) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
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