-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support styled(Component)(({ theme }) => ` #31
Comments
There could be more complexity hidden, that an example. Function could return template literals conditionally, or assign it to a variable, or use explicit return. const StyledDiv = styled.div((props) => {
if (props.isDisabled) {
return `
background-color: #f9f9f9;
`;
}
return `
background-color: blue;
`;
});
const StyledDiv2 = styled.div((props) => {
let styles = `
background-color: blue;
`;
if (props.isDisabled) {
styles = `
background-color: #f9f9f9;
`;
}
return styles;
}); Additionally, I doubt VS Code extension would highlight examples above. Not that it would be blocker, but worth to keep in mind. |
I guess it's for these use cases that we need to use the
I see this not correctly highlighted/autocompleted by the VS Code extension: const StyledDiv = styled.div((props) => {
return `
background-color: #f9f9f9;
`;
}); but this one is correctly highlighted/autocompleted: const StyledDiv = styled.div((props) => `
background-color: #f9f9f9;
`); |
Alright, let's support only implicit return of template literal for an arrow function. I could take a look in a few weeks. PR is always welcome :) |
Released in |
Very cool, it seems to work ![]()
Someone at http://github.com/mui/ will have fun to fix the codebase 😁 |
I think it would be great to support this pattern
styled(Component)(({ theme }) =>
. Today, it doesn't work:Screen.Recording.2024-05-28.at.19.34.19.mov
This is pretty much the same request as in styled-components/vscode-styled-components#194.
The text was updated successfully, but these errors were encountered: