Skip to content
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

Better Component Styling #99

Open
ZeroIntensity opened this issue Nov 28, 2023 · 0 comments
Open

Better Component Styling #99

ZeroIntensity opened this issue Nov 28, 2023 · 0 comments
Labels
api This has to do with the Python API (view) complex This should only be looked at by someone who knows what they're doing delayed Delayed due to another issue improvement Improvement to an existing feature
Milestone

Comments

@ZeroIntensity
Copy link
Owner

ZeroIntensity commented Nov 28, 2023

Improvement Description

Styling right now consists of manually writing style() tags or loading CSS files. I think there could be a better way that this is done. I have a number of ideas on how this could be done, all of which could be implemented.

Improvement Request Example API

Dataclass-like API

from view import body, Style

class MyStyle(Style, cls="my_class"):
    font_family = ["sans-serif"]

body(style=MyStyle)
body(cls="my_class")

CSS Loading API

from view import body, css

body(style=css("index.css"))

Object API

from view import styled, body

my_class = styled(font_family=["sans-serif"])
body(style=styled(font_family=["sans-serif"]))
body(cls=my_class)  # perhaps some magic could be done to make it accessible via cls="my_class" (not a variable reference)

Anything else?

Waiting on #12, of course.

@ZeroIntensity ZeroIntensity added improvement Improvement to an existing feature complex This should only be looked at by someone who knows what they're doing api This has to do with the Python API (view) delayed Delayed due to another issue labels Nov 28, 2023
@ZeroIntensity ZeroIntensity added this to the Beta milestone May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api This has to do with the Python API (view) complex This should only be looked at by someone who knows what they're doing delayed Delayed due to another issue improvement Improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant