Skip to content
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

Make pagination responsive by default #1894

Merged
merged 6 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swift-actors-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/css": patch
---

Make `pagination` responsive by default
39 changes: 38 additions & 1 deletion src/pagination/pagination.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
a,
span,
em {
display: inline-block;
min-width: 32px;
// stylelint-disable-next-line primer/spacing
padding: 5px 10px;
Expand Down Expand Up @@ -84,6 +83,44 @@
clip-path: polygon(6.2px 3.2px, 7.3px 3.2px, 11.5px 7.5px, 11.5px 8.5px, 7.3px 12.8px, 6.2px 11.7px, 9.9px 8px, 6.2px 4.3px, 6.2px 3.2px);
}
}

// Responsive

// Hide everything by default
> * {
display: none;
}

// 0 -> sm
// Only show [Previous] [Next]

> :first-child,
> :last-child,
> .previous_page,
> .next_page {
display: inline-block;
}

// sm -> md
// Also show [first] [last] [current number] and [...]

@include breakpoint(sm) {
> :nth-child(2),
> :nth-last-child(2),
> .current,
> .gap {
display: inline-block;
}
}

// md -> or more
// Show everything

@include breakpoint(md) {
> * {
display: inline-block;
}
}
}

// Unified centered pagination across the site
Expand Down