Skip to content

Commit

Permalink
fix: Allow pagination buttons to shrink if needed. (#1425)
Browse files Browse the repository at this point in the history
Pagination now works on small mobiles and we can feel more secure in removing excess padding from our container query. This also corrects the position of the ellipses, which is now aligned to the text baseline.
  • Loading branch information
notlee authored Feb 5, 2024
1 parent 0e5efd6 commit bbb8908
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
23 changes: 15 additions & 8 deletions components/o3-button/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -369,25 +369,28 @@
color: var(--_o3-button-secondary-inverse-color);
}

.o3-button-pagination,
.o3-button-pagination>.o3-button,
.o3-button-pagination>.o3-button.o3-button-icon--icon-only {
--_o3-button-min-width: 38px;
.o3-button-pagination>.o3-button.o3-button-icon--icon-only,
.o3-button-pagination__ellipsis {
--_o3-button-min-width: auto;
--_o3-button-min-height: 40px;
max-width: 38px;
flex: 1 1 38px;
}

@supports (container-type: inline-size) {
/*
* If container is less than the width of 9 buttons (2 arrows + 7 total pages/ellipses),
* hide some buttons for a 'narrow' view.
*
* Read as: calc(--_o3-button-min-width * 9 + var(--o3-spacing-4xs) * 8) + 24px padding
* Read as: calc(--_o3-button-min-width * 9 + var(--o3-spacing-4xs) * 8)
*/
@container (width <= calc((38px * 9) + (0.5rem * 8) + 24px)) {
@container (width <= calc((38px * 9) + (0.5rem * 8))) {
.o3-button-pagination > [data-o3-button-show-when="wide"] {
display: none;
}
}
@container (width > calc((38px * 9) + (0.5rem * 8) + 24px)) {
@container (width > calc((38px * 9) + (0.5rem * 8))) {
.o3-button-pagination > [data-o3-button-show-when="narrow"] {
display: none;
}
Expand All @@ -412,9 +415,13 @@
}

.o3-button-pagination__ellipsis {
display: flex;
box-sizing: border-box;
justify-content: center;
align-items: center;
font-size: var(--o3-font-size-3);
text-align: center;
min-width: var(--_o3-button-min-width);
line-height: 0;
min-height: var(--_o3-button-min-height);
color: var(--o3-color-palette-black-60);
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bbb8908

Please sign in to comment.