feat: add CSS variable for caption font size #1703
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
With default CSS and parameters and when using dropdown and buttons caption layout, the calendar width changes when cycling through the different months with default locale
This may be seen as an issue for two reasons:
Reproduce
This can be reproduced on the currently deployed documentation website, in the example using caption layout "dropdown-buttons": https://react-day-picker.js.org/basics/navigation#choosing-a-caption-layout
Analysis
With the recent addition of month/year navigation using both dropdowns and buttons and default locales and CSS variables, it happens for specifics months (February, September, November, December) that the width of
.rdp-caption
becomes larger than.rdp-table
because these months have longer names.Solution
I reduced the font-size so that the worst-case scenario (September) fits with dropdown-buttons caption layout. This also works for the other EU locales I've tested (fr, it, es, de). I also changed the font size from % to pixels, because the table width is always --rdp-cell-size times 7 and --rdp-cell-size is in pixels. I though it made sense to add this into a variable, because if someone wants to change the cell size to something smaller, he will have to change the caption font size as well. Waiting for your thoughts on this.
After: