Skip to content

Better Component Styling #99

Open
Open
@ZeroIntensity

Description

@ZeroIntensity

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiThis has to do with the Python API (view)complexThis should only be looked at by someone who knows what they're doingdelayedDelayed due to another issueimprovementImprovement to an existing feature

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions