@@ -15,10 +15,10 @@ function getPageIndicators(pages: number, currentPage: number) {
15
15
if ( pages - currentPage < 3 ) {
16
16
result [ 0 ] = pages - indicatorCount + 1 ;
17
17
} else {
18
- result [ 0 ] = ( currentPage > 3 ) ? currentPage - 2 : 1 ;
18
+ result [ 0 ] = currentPage > 3 ? currentPage - 2 : 1 ;
19
19
}
20
20
for ( let i = 1 ; i < indicatorCount ; ++ i ) {
21
- result [ i ] = result [ i - 1 ] + 1 ;
21
+ result [ i ] = result [ i - 1 ] + 1 ;
22
22
}
23
23
return result . map ( propsFor ) ;
24
24
}
@@ -37,20 +37,30 @@ function PageButtonBar({pages}: {pages: number}) {
37
37
}
38
38
39
39
return (
40
- < nav aria-label = 'pagination' >
41
- < ul className = 'no-bullets button-bar' >
42
- < li > < button disabled = { disablePrevious } onClick = { prevPage } > Previous</ button > </ li >
43
- {
44
- pageIndicators . map ( ( indicator ) =>
45
- < li key = { indicator . page } > < button
40
+ < nav aria-label = "pagination" >
41
+ < ul className = "no-bullets button-bar" >
42
+ < li >
43
+ < button disabled = { disablePrevious } onClick = { prevPage } >
44
+ Previous
45
+ </ button >
46
+ </ li >
47
+ { pageIndicators . map ( ( indicator ) => (
48
+ < li key = { indicator . page } >
49
+ < button
46
50
disabled = { indicator . disabled }
47
51
aria-current = { indicator . selected ? 'page' : 'false' }
48
52
aria-label = { indicator . page }
49
53
onClick = { ( ) => setCurrentPage ( indicator . label ) }
50
- > { indicator . label } </ button > </ li >
51
- )
52
- }
53
- < li > < button disabled = { disableNext } onClick = { nextPage } > Next</ button > </ li >
54
+ >
55
+ { indicator . label }
56
+ </ button >
57
+ </ li >
58
+ ) ) }
59
+ < li >
60
+ < button disabled = { disableNext } onClick = { nextPage } >
61
+ Next
62
+ </ button >
63
+ </ li >
54
64
</ ul >
55
65
</ nav >
56
66
) ;
@@ -62,7 +72,9 @@ export function PaginatorControls({items}: {items: number}) {
62
72
const firstIndex = ( currentPage - 1 ) * resultsPerPage ;
63
73
const endBefore = Math . min ( firstIndex + resultsPerPage , items ) ;
64
74
const resultRange = `${ firstIndex + 1 } -${ endBefore } ` ;
65
- const searchTerm = new window . URLSearchParams ( window . location . search ) . get ( 'q' ) ;
75
+ const searchTerm = new window . URLSearchParams ( window . location . search ) . get (
76
+ 'q'
77
+ ) ;
66
78
67
79
return (
68
80
< div className = "paginator" >
0 commit comments