fix: prevent text from overflowing prev/next links#814
Conversation
🦋 Changeset detectedLatest commit: f3922fe The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
👷 Deploy Preview for astro-starlight processing.
|
b29541c to
2cd86e9
Compare
a3a748a to
4961f7e
Compare
delucis
left a comment
There was a problem hiding this comment.
Love this solution! Thank you for cracking it @julien-deramond 💖
Left a couple of small notes, but I think this is 100% the right solution.
delucis
left a comment
There was a problem hiding this comment.
Awesome — the preview looks good to me! For future reference if anyone wants to see it to test out, it should be here for posterity: https://653800362ca82700088bafb1--astro-starlight.netlify.app/getting-started/
@julien-deramond I think it should be safe to go ahead and remove the test files 🥳
69d6f17 to
f3922fe
Compare
|
delucis
left a comment
There was a problem hiding this comment.
Yay! Thanks again for your persistence figuring this out. Really appreciate it 🤩
What kind of changes does this PR include?
Before the final merge if/when approved
Description
This PR is a follow-up of #756 where we decided to extract this fix for prev/next links in a separate PR. We agreed at the time that the suggested fix wasn't good enough because relying on media queries and values that don't exist already as media queries in Starlight (see discussion from #756 (comment)).
A possible simple fix would have been to use media containers because what we really want is a specific rendering based on the size of the container but the browsers' support is not yet good enough.
So I had to rely on some advanced features of
display: gridoften used to create complex layouts.The following code already existed and worked well for the rendering of each pagination item.
Since we are playing with auto layouts and sizes, the icon size can sometimes be reduced (or the icon can "disappear"), so the following allows us to keep the same size for the icon:
The most complex part is definitely the following:
The
grid-template-columnsproperty defines the columns of the grid. Therepeat(auto-fit, minmax(200px, 1fr))value means that the grid will automatically create as many columns as it can fit in the available space, with a minimum width of 200px and a maximum width of 1fr (which means the columns will take up equal space).If I say it differently, the pagination item will take the whole space until there's enough space to render two 200px pagination items on the same row.
The
grid-gapproperty sets the gap between the columns.Tested environments
In terms of browsers' support, it seems to be safe to use:
display: gridgrid-template-columnsrepeat()minmax()So I tested only the oldest combinations of browsers/versions listed in our compatibility browsers list):