-
Notifications
You must be signed in to change notification settings - Fork 186
Use CSS grid for card grid layout
#702
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
Use CSS grid for card grid layout
#702
Conversation
|
Awesome, thanks @philippschmitt ! That's the most promising proposal I've seen so far. Here are some findings. Not sure what's possible, but let me just document what I find: (links should work with a dev env)
I'll leave it there for now and do further investigations after we fixed the first issues. |
|
Thank you for the feedback @m-mohr
It's nontrivial (at least without more investigation) to prevent a single card from stretching across the entire horizontal space. However, I think the layout problem you noted can be mitigated by left-aligning the text on the cards. This is something I wanted to propose regardless. IMO it increases readability of the cards and looks neater overall.
I made a change in 79da502 to center the image if it's smaller than the available space. We could hide the gray background in such cases but I think it gives a little structure to the layout. Unless it creates an issue with some data, I'd keep it.
I tried this out in d1ea484. (Only tested on catalogs!) My takeaway is that it sometimes helps a little bit and sometimes it creates chaos. Because of this I'm in favor of rolling back this commit and not doing this. What do you think? Examples below: It works well in this example where one title needs two rows:
It looks bad in this example:
|
d1ea484 to
c92379d
Compare
|
Hi @philippschmitt, thank you for the updates! I've just merged the upstream changes into this branch and then started consolidating the CSS & code across Catalog and Item so that hopefully we have less inconsistencies / better maintenance. I also cleaned the .card-columns CSS definitions that were now unused. I agree with all your changes and suggestions, even 7 is not too bad I think. I guess that's a matter of taste? Or is there any UI/UX best practice that would disallow the current implementation? I've found one additional bug. There are some pixels from the fourth line showing, which was not the case before: |
grid for card grid layoutgrid for card grid layout
|
Hi @philippschmitt, while testing I also came across the following UI/UX issues.
|
If you like it, let's try it out — I'm not aware of a best practice. And looking at it again I also like it more now :)
I don't quite understand why it happens but I found a solution, I think, in this article discussing workarounds until |
|
@saidy-moregeo I took a look at the BON in a Box catalog but can't reproduce the issue. Could you please send a link, screenshot, and what browser you're seeing this in? @m-mohr Could you please send a link to reproduce this request:
|
|
@philippschmitt Thanks for the updates, will test it. The "Features component" task is an internal task for us, we need to update some other places once we have a final solution for items and catalogs in place. |
fe6d401 to
93a2ab1
Compare
|
@philippschmitt I was referring to the following: in rows with a mixture of cards with different descriptions content size, those with shorter descriptions have noticeably larger spacing between the title and description compared to cards with longer content. However, @m-mohr clarified that this is intentional. link: http://localhost:8080/external/stac.geobon.org/
|









This PR implements CSS grid for the card layout to address usability concerns in #427
The implementation uses
subgridto show image placeholders across all columns when there is at least one card with an image in a certain row; and collapses the placeholders when there is no image in a row.This behavior could be extended further to make sure headings, summaries, date times are also always aligned, but that's not implemented currently.
Demo

This is a draft. @m-mohr Could you test this and share examples for edge cases that need to be addressed before merging?