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

Grid Component #5

Open
anandology opened this issue Nov 19, 2022 · 1 comment
Open

Grid Component #5

anandology opened this issue Nov 19, 2022 · 1 comment

Comments

@anandology
Copy link
Member

CSS Grids makes it very easy to make grids. It is much simpler than using bootstrap like columns and is responsive without having to use media queries.

Proposed API

grid = Grid(columns=3, gap="10px")
for i in range(10):
    grid << i

All the css properties of the grid can be set using the .css method. This is advanced usage and once we figure out the common patterns, we'll expose them as regular api.

grid = Grid()
for i in range(10):
    grid << "Lorem ipsum dolor sit amet, consectetur adipiscing elit"

grid.css("template-template-columns", "repeat(auto-fit, minmax(300px, 1fr))")

References

@anandology
Copy link
Member Author

I think css hack that I showed in the last example, could be abstracted as follows:

grid = Grid(gap="10px").autofit(min_width="300px")
for i in range(10):
    grid << i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant