1
1
<template >
2
2
<div class =" base-pagination" >
3
- <component
4
- :is =" numberElement"
5
- :to =" getLinkPath(active - 1 > 0 ? active - 1 : 1)"
6
- :aria-disabled =" active <= 1"
7
- :tabindex =" active <= 1 ? -1 : 0"
3
+ <div
8
4
:class =" [
9
5
'base-pagination__arrow-wrapper',
10
- { 'base-pagination-arrow -inactive': active <= 1 }
6
+ { 'base-pagination__arrow-icon -inactive': active <= 1 }
11
7
]"
12
- aria-label =" Previous page"
13
- @click.native =" active - 1 > 0 ? setActivePage(active - 1) : false"
14
- @click =" active - 1 > 0 ? setActivePage(active - 1) : false"
15
- @keypress.enter =" active - 1 > 0 ? setActivePage(active - 1) : false" >
16
- <SvgIcon
17
- class =" base-pagination-arrow base-pagination-arrow-left"
18
- name =" arrow-left" />
19
- </component >
8
+ @click =" active - 1 > 0 ? setActivePage(active - 1) : false" >
9
+ <component
10
+ :is =" 'a'"
11
+ :to =" getLinkPath(active - 1 > 0 ? active - 1 : 1)"
12
+ :aria-disabled =" active <= 1"
13
+ :tabindex =" active <= 1 ? -1 : 0"
14
+ aria-label =" Previous page"
15
+ class =" base-pagination__arrow"
16
+ @keypress.enter =" active - 1 > 0 ? setActivePage(active - 1) : false" >
17
+ <SvgIcon
18
+ class =" base-pagination__arrow-icon base-pagination__arrow-icon-left"
19
+ name =" arrow-left" />
20
+ </component >
21
+ </div >
20
22
<div
21
23
v-if =" total > maxNumbers"
22
- class =" base-pagination-row" >
23
- <component
24
- :is =" numberElement"
24
+ class =" base-pagination__row" >
25
+ <div
25
26
v-if =" start !== 1"
26
- :to =" getLinkPath(1)"
27
- :tabindex =" active === 1 ? -1 : 0"
28
- :class =" ['base-pagination-number', { 'base-pagination-number-active': active === 1}]"
29
- aria-label =" page 1"
30
- @click.native =" setActivePage(1)"
31
- @click =" setActivePage(1)"
32
- @keypress.enter =" setActivePage(1)" >
33
- {{ 1 }}
34
- </component >
27
+ :class =" ['base-pagination__number', { 'base-pagination__number-active': active === 1}]"
28
+ @click =" setActivePage(1)" >
29
+ <component
30
+ :is =" numberElement"
31
+ :to =" useLinkElement ? getLinkPath(1) : false"
32
+ :tabindex =" active === 1 ? -1 : 0"
33
+ aria-label =" page 1"
34
+ class =" base-pagination__number-inner"
35
+ @keypress.enter =" setActivePage(1)" >
36
+ {{ 1 }}
37
+ </component >
38
+ </div >
35
39
<span
36
40
v-if =" start > 2"
37
- class =" base-pagination-more" >⋯ ; </span >
38
- <component
39
- :is =" numberElement"
41
+ class =" base-pagination__more" >⋯ ; </span >
42
+ <div
40
43
v-for =" n in subset"
41
44
:key =" n"
42
- :to =" getLinkPath(n)"
43
- :tabindex =" active === n ? -1 : 0"
44
- :aria-label =" `Page ${n}`"
45
- :class =" ['base-pagination-number', { 'base-pagination-number-active': active === n}]"
46
- @click.native =" setActivePage(n)"
47
- @click =" setActivePage(n)"
48
- @keypress.enter =" setActivePage(n)" >
49
- {{ n }}
50
- </component >
45
+ :class =" ['base-pagination__number', { 'base-pagination__number-active': active === n}]"
46
+ @click =" setActivePage(n)" >
47
+ <component
48
+ :is =" numberElement"
49
+ :to =" getLinkPath(n)"
50
+ :tabindex =" active === n ? -1 : 0"
51
+ :aria-label =" `Page ${n}`"
52
+ class =" base-pagination__number-inner"
53
+ @keypress.enter =" setActivePage(n)" >
54
+ {{ n }}
55
+ </component >
56
+ </div >
51
57
<span
52
58
v-if =" (end) < (total - 1) && (end) !== (total - 1)"
53
- class =" base-pagination-more" >⋯ ; </span >
54
- <component
55
- :is =" numberElement"
59
+ class =" base-pagination__more" >⋯ ; </span >
60
+ <div
56
61
v-if =" (end - 1) < (total - 1) && (end - 1) !== (total - 1)"
57
- :to =" getLinkPath(total)"
58
- :tabindex =" active === total ? -1 : 0"
59
- :aria-label =" `Page ${total}`"
60
- :class =" ['base-pagination-number', { 'base-pagination-number-active': active === total}]"
61
- @click.native =" setActivePage(total)"
62
- @click =" setActivePage(total)"
63
- @keypress.enter =" setActivePage(total)" >
64
- {{ total }}
65
- </component >
62
+ :class =" ['base-pagination__number', { 'base-pagination__number-active': active === total}]"
63
+ @click =" setActivePage(total)" >
64
+ <component
65
+ :is =" numberElement"
66
+ :to =" getLinkPath(total)"
67
+ :tabindex =" active === total ? -1 : 0"
68
+ :aria-label =" `Page ${total}`"
69
+ class =" base-pagination__number-inner"
70
+ @keypress.enter =" setActivePage(total)" >
71
+ {{ total }}
72
+ </component >
73
+ </div >
66
74
</div >
67
75
<div
68
76
v-else
69
- class =" base-pagination-row" >
70
- <component
71
- :is =" numberElement"
77
+ class =" base-pagination__row" >
78
+ <div
72
79
v-for =" n in total"
73
80
:key =" n"
74
- :to =" getLinkPath(n)"
75
- :tabindex =" active === n ? -1 : 0"
76
- :aria-label =" `Page ${n}`"
77
- :class =" ['base-pagination-number', { 'base-pagination-number-active': active === n}]"
78
- @click.native =" setActivePage(n)"
79
- @click =" setActivePage(n)"
80
- @keypress.enter =" setActivePage(n)" >
81
- {{ n }}
82
- </component >
81
+ :class =" ['base-pagination__number', { 'base-pagination__number-active': active === n}]"
82
+ @click =" setActivePage(n)" >
83
+ <component
84
+ :is =" numberElement"
85
+ :to =" useLinkElement ? getLinkPath(n) : false"
86
+ :tabindex =" active === n ? -1 : 0"
87
+ :aria-label =" `Page ${n}`"
88
+ class =" base-pagination__number-inner"
89
+ @keypress.enter =" setActivePage(n)" >
90
+ {{ n }}
91
+ </component >
92
+ </div >
83
93
</div >
84
- <component
85
- :is =" numberElement"
86
- :to =" getLinkPath(active + 1 <= total ? active + 1 : total)"
87
- :aria-disabled =" active >= total"
88
- :tabindex =" active >= total ? -1 : 0"
94
+ <div
89
95
:class =" [
90
96
'base-pagination__arrow-wrapper',
91
- { 'base-pagination-arrow -inactive': active >= total }
97
+ { 'base-pagination__arrow-icon -inactive': active >= total }
92
98
]"
93
- aria-label =" Next Page"
94
- @click.native =" active + 1 <= total ? setActivePage(active + 1) : false"
95
- @click =" active + 1 <= total ? setActivePage(active + 1) : false"
96
- @keypress.enter =" active + 1 <= total ? setActivePage(active + 1) : false" >
97
- <SvgIcon
98
- class =" base-pagination-arrow base-pagination-arrow-right"
99
- name =" arrow-left" />
100
- </component >
99
+ @click =" active + 1 <= total ? setActivePage(active + 1) : false" >
100
+ <component
101
+ :is =" numberElement"
102
+ :to =" getLinkPath(active + 1 <= total ? active + 1 : total)"
103
+ :aria-disabled =" active >= total"
104
+ :tabindex =" active >= total ? -1 : 0"
105
+ aria-label =" Next Page"
106
+ class =" base-pagination__arrow"
107
+ @keypress.enter =" active + 1 <= total ? setActivePage(active + 1) : false" >
108
+ <SvgIcon
109
+ class =" base-pagination__arrow-icon base-pagination__arrow-icon-right"
110
+ name =" arrow-left" />
111
+ </component >
112
+ </div >
101
113
</div >
102
114
</template >
103
115
@@ -229,16 +241,16 @@ export default {
229
241
align-items : center ;
230
242
justify-content : center ;
231
243
232
- .base-pagination_arrow -wrapper , .base-pagination-number {
244
+ .base-pagination__arrow -wrapper , .base-pagination__number {
233
245
cursor : pointer ;
234
246
}
235
247
236
- .base-pagination-row {
248
+ .base-pagination__row {
237
249
display : flex ;
238
250
align-items : center ;
239
251
justify-content : center ;
240
252
241
- .base-pagination-number {
253
+ .base-pagination__number {
242
254
font-weight : bold ;
243
255
background-color : $box-color ;
244
256
padding : 0 $spacing-small ;
@@ -254,11 +266,11 @@ export default {
254
266
margin-right : 0 ;
255
267
}
256
268
257
- & :hover , & :focus , & :active {
269
+ & :hover , & :focus , & :active , & :focus-within {
258
270
color : $app-color ;
259
271
}
260
272
261
- & .base-pagination-number -active {
273
+ & .base-pagination__number -active {
262
274
color : white ;
263
275
background-color : $app-color ;
264
276
cursor : default ;
@@ -269,55 +281,49 @@ export default {
269
281
}
270
282
}
271
283
272
- .base-pagination-more {
284
+ .base-pagination__more {
273
285
margin-right : $spacing-small ;
274
286
}
275
287
}
276
288
277
289
.base-pagination__arrow-wrapper {
278
- & :hover .base-pagination-arrow ,
279
- & :active .base-pagination-arrow ,
280
- & :focus .base-pagination-arrow {
290
+ & :hover .base-pagination__arrow .base-pagination__arrow-icon ,
291
+ .base-pagination__arrow :active .base-pagination__arrow-icon ,
292
+ .base-pagination__arrow :focus .base-pagination__arrow-icon {
281
293
fill : $app-color ;
282
294
}
283
295
284
- .base-pagination-arrow {
296
+ .base-pagination__arrow-icon {
285
297
height : $icon-medium ;
286
298
width : $icon-medium ;
287
299
margin : 0 $spacing ;
288
300
289
- & .base-pagination-arrow -right {
301
+ & .base-pagination__arrow-icon -right {
290
302
transform : rotate (180deg );
291
303
}
292
304
}
293
305
294
- & .base-pagination-arrow -inactive {
306
+ & .base-pagination__arrow-icon -inactive {
295
307
cursor : default ;
296
308
297
- .base-pagination-arrow ,
298
- & :hover .base-pagination-arrow ,
299
- & :active .base-pagination-arrow ,
300
- & :focus .base-pagination-arrow {
309
+ .base-pagination__arrow .base-pagination__arrow-icon ,
310
+ & :hover .base-pagination__arrow .base-pagination__arrow-icon {
301
311
fill : $graytext-color ;
302
312
}
303
313
}
304
-
305
- & :disabled .base-pagination-arrow {
306
- fill : red ;
307
- }
308
314
}
309
315
310
- .base-pagination-row , .base-pagination-arrow {
316
+ .base-pagination__row , .base-pagination__arrow-icon {
311
317
flex : 0 0 auto ;
312
318
}
313
319
314
- .base-pagination__arrow-wrapper , .base-pagination-number {
320
+ .base-pagination__arrow , .base-pagination__number-inner {
315
321
outline : none ;
316
322
}
317
323
}
318
324
319
325
@media screen and (max-width : $mobile ) {
320
- .base-pagination-arrow {
326
+ .base-pagination__arrow-icon {
321
327
margin : 0 $spacing-small ;
322
328
}
323
329
}
0 commit comments