-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathpagination.scss
157 lines (139 loc) · 3.35 KB
/
pagination.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// Needs refactoring
// stylelint-disable selector-max-type
.pagination {
a,
span,
em {
min-width: 32px;
// stylelint-disable-next-line primer/spacing
padding: 5px 10px;
font-style: normal;
// stylelint-disable-next-line primer/typography
line-height: 20px;
color: var(--fgColor-default, var(--color-fg-default));
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
user-select: none;
// stylelint-disable-next-line primer/borders, primer/colors
border: $border-width $border-style transparent;
// stylelint-disable-next-line primer/borders
border-radius: $border-radius;
transition: border-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);
&:hover,
&:focus {
text-decoration: none;
border-color: var(--borderColor-default, var(--color-border-default));
transition-duration: 0.1s;
}
&:active {
border-color: var(--borderColor-muted, var(--color-border-muted));
transition: none;
}
}
.previous_page,
.next_page {
color: var(--fgColor-accent, var(--color-accent-fg));
}
.current,
.current:hover,
[aria-current]:not([aria-current='false']) {
color: var(--fgColor-onEmphasis, var(--color-fg-on-emphasis));
background-color: var(--bgColor-accent-emphasis, var(--color-accent-emphasis));
border-color: transparent;
}
.gap,
.disabled,
[aria-disabled='true'],
.gap:hover,
.disabled:hover,
[aria-disabled='true']:hover {
color: var(--fgColor-disabled, var(--color-primer-fg-disabled));
cursor: default;
border-color: transparent;
}
// chevron icons using clip-path
@supports (clip-path: polygon(50% 0, 100% 50%, 50% 100%)) {
.previous_page::before,
.next_page::after {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: text-bottom;
content: '';
background-color: currentColor;
}
// chevron-left
.previous_page::before {
margin-right: var(--base-size-4);
clip-path:
polygon(
9.8px 12.8px,
8.7px 12.8px,
4.5px 8.5px,
4.5px 7.5px,
8.7px 3.2px,
9.8px 4.3px,
6.1px 8px,
9.8px 11.7px,
9.8px 12.8px
);
}
// chevron-right
.next_page::after {
margin-left: var(--base-size-4);
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
.paginate-container {
margin-top: var(--base-size-16);
margin-bottom: var(--base-size-16);
text-align: center;
.pagination {
display: inline-block;
}
}