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

Prefab component for Bootstrap's grid #441

Open
lemniscate8 opened this issue Jul 28, 2021 · 0 comments
Open

Prefab component for Bootstrap's grid #441

lemniscate8 opened this issue Jul 28, 2021 · 0 comments

Comments

@lemniscate8
Copy link
Collaborator

lemniscate8 commented Jul 28, 2021

Bootstrap's grid system is a super nice way to create responsive layouts that adapt to the viewport size. Maybe we could provide some functions or a prefab component that will make adding the classes and managing rows easy.
Here's an idea of a possible interface:

Grid grid(Grid::NoWrap, "my_grid",);
grid << Grid::Col(simulationDiv, "col-md-8") << Grid::Col(controlsDiv, "col-md-4") << Grid::EndRow;
grid << Grid::Col(div1, "col-md-6", "col-lg-4") << Grid::Col(div2, "col-md-6", "col-lg-4")
     << Grid::Col(div3, "col-md-6",  "col-lg-4");

Grid::Col could apply the specified classes to the components given as the its first argument and Grid::EndRow could act like std::endl and start adding components to a new row if more are added. The Grid::NoWrap argument would add these classes directly to the components without wrapping in a div.

The example I gave should make the simulation environment take up 2/3's of the row unless the viewport shrinks under medium width (tablet size) then it and the controls should take up full width. Similar for the second row except there are two levels at which components resize.

It's still a lot work to come up with a harmonious layout and there's no way around that, but this would make it a lot easier than doing all the SetAttrs yourself

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

No branches or pull requests

1 participant