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] Allow items to be containers as well [enhancement] #7744

Closed
damianobarbati opened this issue Aug 12, 2017 · 5 comments
Closed

[Grid] Allow items to be containers as well [enhancement] #7744

damianobarbati opened this issue Aug 12, 2017 · 5 comments
Assignees
Labels
component: Grid The React component. docs Improvements or additions to the documentation good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@damianobarbati
Copy link

What about allowing a Grid item to act as a container as well?
In a common scenario where a Grid[type=item] must contain 3 nested items we have to :

Grid[type=item]
   Grid[type=container]
       Grid[type=item]
       Grid[type=item]
       Grid[type=item]

when we could just:

Grid[type=item][type=container]
    Grid[type=item]
    Grid[type=item]
    Grid[type=item]

A display:flex div can have flex property as well and viceversa: we would achieve less DOM and the same effect.

@oliviertassinari oliviertassinari added the component: Grid The React component. label Aug 12, 2017
@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 12, 2017

That's an advanced use case, it's not documented as it might be counter intuitive for some users.
Still, we have a regression test case, you can find the visual output on Argos-CI.

@emmanuelbuah
Copy link

@oliviertassinari I feel allowing a div to act as a container and an item at the same time is more logical that excess nested grids to accomplish the same objective. I could be missing something here, potentially in relation to breakpoints but I think it will save users a lot of time and reduce the number of elements rendered on a page. I'd like like to understand the advanced nature of this change. I'd be happy to help if needed.

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Mar 28, 2018
@oliviertassinari
Copy link
Member

@emmanuelbuah Alright, I'm reopening this issue so we document this behavior. We would love some help. I believe it's about finding a compelling use case where the item + container on the same DOM element makes sense :).

@avdd
Copy link

avdd commented Jun 7, 2018

@oliviertassinari I disagree that this is an advanced use case. I'm fairly new to grids and flex and as soon as I wanted to nest layouts (which was immediately) I considered this. So your compelling use case is: any time you want to nest a flex layout :-)

@oliviertassinari oliviertassinari added the good first issue Great for first contributions. Enable to learn the contribution process. label Jun 9, 2018
@oliviertassinari
Copy link
Member

@cdietze has built a nice demo: https://codesandbox.io/s/8xw3205y10. It's a good starting point for documentation this feature :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. docs Improvements or additions to the documentation good first issue Great for first contributions. Enable to learn the contribution process.
Projects
None yet
Development

No branches or pull requests

4 participants