-
Notifications
You must be signed in to change notification settings - Fork 782
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 both object and string as value for style attribute. #756
Comments
We have two PR about it: #675 and #676 I thought this feature would be very useful when you want to render svg as jsx - no need to convert manually a lot of style attributes. But later I come up with solution: always convert inline styles into svg attributes using SVGO. For example: |
I second this request. Supporting both strings and objects for the style attribute would be 💯 (And it would be analog to building in classcat support in the class attribute, where class as string-list and object would both work) Now that hyperapp isn't quite so size focused anymore, it shouldn't be a problem (although the implementation is tiny anyway) |
@rbiggs Let's do it then! 🎉 |
Yay!!! 🎉🌈🍻To be honest, I've been hacking Hyperapp and Pico-ultra-superfine since forever to support this feature. |
#Everybody be hacking his own |
You should be able to use a string or an object to set the With a stringconst viewRed = state => <div style="color:red;">Consider it done!</div> With an objectconst viewRed = state => <div style={{ color: "red" }}>Consider it done!</div> |
I removed this issue from the V2 milestone as I don't think I will be bringing this feature over to V2. I was too eager to resolve this issue and didn't pay it enough attention. It's all my bad, @rbiggs was simply submitting a feature request. 🙇 I don't see how this feature could be seen as superior to current object syntax, so I am not compelled to have this added to V2. |
In both Hyperapp and Superfine the only way to apply an inline style is by providing a object. This is great if you need to create CSS values dynamically from code. But most of the time I'm just applying some simple styles, no need to calculate anything. Supporting both would only require a minor change to how to set the style attribute in
updateAttribute
:Then you could use:
or:
Maybe it's just me, but I feel its easier to type out a string for styles than creating an object inline.
The text was updated successfully, but these errors were encountered: