-
Notifications
You must be signed in to change notification settings - Fork 207
Css grid for thumbnails #906
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
Css grid for thumbnails #906
Conversation
…nx-gallery into feature/thumbnails_grid
@lucyleeow do you want to look first? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had a look @larsoner but I am not very familiar with html/css. The parts I understood look good and I agree it looks better.
My only note is: is this comment relevant? #905 (comment)
Here are some thoughts about the comment. In order for users to have clear instructions on how to update their custom CSS, I think I could write a comment with all needed details in this PR, and add a link to it in the changelogs. |
I tested this out locally on MNE-Python's sphinx gallery page and it worked well! @alexisthual have you also tested it locally on some projects you currently maintain/contribute to? If so, +1 for merge from me, except just one more thing...
Indeed I think this would be valuable. Feel free to push this, and @lucyleeow and I can give it a read and merge! |
Yaaaay, glad to hear that 😄
I am actually contributing this as part of a big theme refactoring for nilearn (see relevant PR if you're interested). We are switching to furo, and this PR works great with this theme.
Great, I'll do this soon! |
Okay great -- MNE uses pydata-sphinx-theme so it's good to know it looks good in multiple themes |
Thumbnail CSS migration guideIn case your project includes some custom css dedicated to ThumbnailConcerning Previous thumbnail DOM structure: <div class="sphx-glr-thumbcontainer" tooltip="{tooltip}">
<div class="figure align-default">
<img />
<p class="caption">
<span class="caption-text">
<a class="reference internal">
<span class="std std-ref">{link}</span>
</a>
</span>
<a class="headerlink">¶</a>
</p>
</div>
</div> New thumbnail DOM structure: <div class="sphx-glr-thumbcontainer" tooltip="{tooltip}">
<img />
<p>
<a class="reference internal">
<span class="std std-ref">{link}</span>
</a>
</p>
<div class="sphx-glr-thumbnail-title">{link}</div>
</div> Your custom css should be modified to match these new class names. Thumbnails gridThumbnails are now displayed using css grids instead of css float. <div class="sphx-glr-thumbnails">
<div class="sphx-glr-thumbcontainer">...</div>
<div class="sphx-glr-thumbcontainer">...</div>
...
</div> You can tweak the grid behaviour by modifying .sphx-glr-thumbnails{
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
} This line tells the grid to have as many columns as |
I just added a comment above (which can easily be edited) and a link to the changelog. Also, I added one last change to make the grid columns responsive. Each column will be at least 160px (so that two columns can fit on smartphones), but these columns will be able to grow if more space is available (they can't grow too much though, if not it means we could add a new column). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alexisthual, nice write up here: #906 (comment)
I would be tempted to add this to faq.rst
as a section with something like 'Why has my thumbnail appearance changed?'
Done 🙂 The new subsection in the FAQ mainly contains a link to the migration guide and to the PR. |
Thanks @alexisthual ! |
The div.figure was removed in sphinx-gallery/sphinx-gallery#906 The workaround is also not needed anymore because that PR fixes the centering.
The div.figure was removed in sphinx-gallery/sphinx-gallery#906 The workaround is also not needed anymore because that PR fixes the centering.
The div.figure was removed in sphinx-gallery/sphinx-gallery#906 The workaround is also not needed anymore because that PR fixes the centering.
Fixes #905.