-
Notifications
You must be signed in to change notification settings - Fork 415
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 Linaria Components #1219
Comments
The dynamic styling in Linaria is based on css variables, but they are suitable only for property values. So… it's just impossible to implement your approach. Something similar has been discussed here #244 |
as shown in the POC it is totally possible by pregenerating class names - soon we will have native css class nesting which would make that even easier |
Your PoC requires parse styles to create a list of class names. It means that if we want to interpolate or wrap a styled component in another styled, we will have to evaluate its styles, whereas now we can just use a pre-generated class name. It is slow. However, we already do it in |
thank you for reopening the discussion and for further insights why this might not be a good idea 👍 I guess you are right - one very hard problem might be the order when wrapping components - or do you see any further issues? |
After giving it more consideration, I believe we can still utilize pre-generated class names for referencing and compositions. This will prevent us from having to do additional work during the evaluation stage. Therefore, your approach appears to be viable. |
Describe the feature
What do you think about an approach which would allow to toggle class names and inject css variables like this?
It's totally possible with typescript and might work very well with the upcoming css nesting proposal:
https://codesandbox.io/s/yacijs-p0xt3m?file=/src/App.tsx:111-315
Motivation
This idea would allow to connect css classes with any complex logic.
The runtime code would only keep the logic and the class names.
Possible implementations
https://codesandbox.io/s/yacijs-p0xt3m?file=/src/App.tsx:111-315
The text was updated successfully, but these errors were encountered: