Skip to content

Commit

Permalink
Make pagination responsive by default (#1894)
Browse files Browse the repository at this point in the history
* Make pagination responsive by default

* Lint

* Create swift-actors-drum.md

* Remove duplicate selector

* Remove initial display

This was overridden before with the `.page-responsive .pagination` selector
  • Loading branch information
simurai committed Jan 20, 2022
1 parent 68adc95 commit d1adf59
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
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

0 comments on commit d1adf59

Please sign in to comment.