-
Notifications
You must be signed in to change notification settings - Fork 949
GridBox widget #1942
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
Comments
Here are some interesting resources from a HN article on CSS grids: https://news.ycombinator.com/item?id=16292094 |
I'd like to give this a shot. |
Hi, I had a question - There is a lot of shared code that I could reuse. But Box was meant to be a flexbox implementation. I could (1) create an abstract class, say "CSSLayout" (name TBD, but users shouldn't touch this) and move the common functionality into that. Box and GridBox would both subclass this and set (Note - I was able to get this to work even otherwise though, just by making GridBox inherit from Box and changing display in the child's constructor ) |
I think Gridbox should not inherit from Box. The big thing that Box gives you is a children attribute, but that's probably not useful in a 2d layout to have a single list of children. |
I suppose you could make a CSSLayout widget, but maybe that's not worth it? In my mind, the GridBox was inheriting directly from DOMWidget - but you are in the code, so you have better information than I do. |
Thanks for working on this!!! |
I agree that the BoxModel contains just a children attribute, but the BoxView seems to contain some logic that we might end up re-implementing ?
Seems like a good time to finalize the API - did you have a 2D list (list of lists) in mind, as the input ? |
Example :
This will create 2 rows of 3 columns each |
Good question. I haven't read too deeply into the grid spec, so I'm not up to speed on what would be a natural api. Layouts are used as a generic mechanism across all widgets, though. I imagine we would have more specific grid-type properties on the widget itself? |
I'm not sure what you mean by grid-specific. Involve the grid properties in the constructor or expose them as attributes ? Some other API suggestions off the top of my head -
What would you expect (as a user) from GridBox ? If you don't recollect the CSS Grid spec, your idea of a natural API might be more intuitive :) |
What about looking at the wxWidgets Qt API's. I found the wxWidgets sizers to be quite intuitive. Maybe setting it all at once at the contructor is not the way to go, and the details of how the information layout is encoded should be hidden from users. |
I'm not a fan of my suggestions either.:) I just can't think of anything
better than GridBox taking a list of widgets and maybe have the css grid
spec exposed as attributes on GridWidget.
I will try to think of something better and put up a WIP PR.
Do we want to hide the implementation from the user ? For Box, the docs
clearly say that Box exposes the entire FlexBox spec and I thought that was
a great idea, it gives users a lot of power.
…On Fri 20 Apr, 2018, 1:56 AM Maarten Breddels, ***@***.***> wrote:
What about looking at the wxWidgets Qt API's. I found the wxWidgets sizers
to be quite intuitive. Maybe setting it all at once at the contructor is
not the way to go, and the details of how the information layout is encoded
should be hidden from users.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1942 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AImSDBSzoMoe7cx62fsVZlhwcmOpSeuuks5tqPLtgaJpZM4RyBqj>
.
|
I agree with @Madhu94 about taking a single list of widgets and transparently exposing the CSS grid attributes. |
I would go with an inheritance of
|
Hi @Madhu94, I was thinking about working on it today. Did you start already or can I do it? |
Yes, I did start. Did you want to work on this ?
…On Mon 23 Apr, 2018, 2:35 PM martinRenou, ***@***.***> wrote:
Hi @Madhu94 <https://github.com/Madhu94>, I was thinking about working on
it today. Did you start already or can I do it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1942 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AImSDA1IfiGmPw65t3QKa6FtwWnQifMfks5trZlkgaJpZM4RyBqj>
.
|
No it's ok go on :) I don't want to interrupt you in your work |
Thank you so much.
…On Mon 23 Apr, 2018, 2:51 PM martinRenou, ***@***.***> wrote:
No it's ok go on :) I don't want to interrupt you in your work
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1942 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AImSDBm0QnGaG8bBZlwsQVUb_eJmLi_6ks5trZ0hgaJpZM4RyBqj>
.
|
@Madhu94 don't hesitate to show what you have so far if you are working on this. |
#2064 I made a WIP PR, let me know if there is something wrong |
Looks like this is fixed by #2107 |
Now that CSS grid is making its way into browsers, I think it would be great to have (in core widgets) a GridBox widget that places its widgets in a grid using the CSS grid spec.
The text was updated successfully, but these errors were encountered: