-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
fix: prevent text from overflowing prev/next links #814
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
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.
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.
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.
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
|
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.
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: grid
often 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-columns
property 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-gap
property sets the gap between the columns.Tested environments
In terms of browsers' support, it seems to be safe to use:
display: grid
grid-template-columns
repeat()
minmax()
So I tested only the oldest combinations of browsers/versions listed in our compatibility browsers list):