-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[styled-engine] Fix tagged template syntax with multiple expressions #23269
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
88dcc2a
[test] experimentalStyled and dynamic styling
eps1lon fafd7c5
experiments
mnajdova d542992
replaced padding with padding-left
mnajdova c49799d
final fix maybe
mnajdova a476431
prettier
mnajdova 81dab2d
added more tests
mnajdova 2c410ad
prettier
mnajdova 63b24bf
Remove excessive setup
eps1lon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
import scStyled from 'styled-components'; | ||
|
||
export default function styled(tag, options) { | ||
let scStyledPrepared; | ||
|
||
if (options) { | ||
scStyledPrepared = scStyled(tag).withConfig({ | ||
return scStyled(tag).withConfig({ | ||
displayName: options.label, | ||
shouldForwardProp: options.shouldForwardProp, | ||
}); | ||
} else { | ||
scStyledPrepared = scStyled(tag); | ||
} | ||
|
||
// TODO: This should not be required once we solve the warning `You have illegal escape sequence in your template literal` | ||
return (styles) => { | ||
return scStyledPrepared(...styles); | ||
}; | ||
return scStyled(tag); | ||
} | ||
|
||
export { ThemeContext } from 'styled-components'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This was my main point of interest since transpiling this results in quite a bit of babel helpers if array-spread isn't supported. But that's only the case for our /legacy bundle in v5 🎉
Though my the micro-perf part of my brain does want to dive into some v8 internals and see what's better 😁
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.
In my mind, when I see
I am able to immediately conclude that this is a copy of the array with additional elements, for every other syntax I would need to take a closer look to decide whether it's a copy or mutation :) Of course this is probably just my preference, but you are probably right that it requires more advanced transpiling behind the scene :D