-
Notifications
You must be signed in to change notification settings - Fork 35
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
CSS "Module" #38
Comments
IMHO, I think the original dictionary approach is more intuitive regarding CSS (since the syntax is relatively similar), but if we were to go with a function that returns a dictionary I think Simply because I think div("hello", style=css(
border="red 3px solid",
padding="10px 20px 10px 20px",
display="inline-block",
fontWeight="600",
color="red"
)) looks better than div("hello", style=style(
border="red 3px solid",
padding="10px 20px 10px 20px",
display="inline-block",
fontWeight="600",
color="red"
)) |
Yeah It sounds like you're also more in favor of the raw dictionary which is cool with me because we can just do nothing and let people continue to use it the way they want. |
Might I suggest we look into building utilities for something like NotebookNode from nbformat, so that we have access to attribute based reassignment? We could augment it with a js like fallback where dot access does not raise a keyerror if the key is not present but instead returns None. but then it would probably be more appropriate for it to be |
Note I'm not suggesting we shouldn't allow dictionaries in there — that should always be possible. It also might be fun to be able to link one of these objects to a update handler so that you could modify how a VDOM object renders after the fact… but that's probably over-the-top especially for the 1.0. It might be nice to have a vdom element that can essentially add a CSS sheet to the page even if it's not passed in via a style sheet. This would be needed to encourage people to use CSS selector like logic for consistent styling information. |
Since the
style
attribute has to be a dict pure code has to be written like this:Since I really like using keyword arguments throughout (since we use it for all the DOM properties), I sometimes use a
dict
, sometimes aliasing it asstyle
:What would you all think if we had from
from vdom import style
orfrom vdom import css
, where it was just a simple function that turned all keyword arguments into the proper style dict. This would help us close #31, at least for styles.The text was updated successfully, but these errors were encountered: