File tree Expand file tree Collapse file tree 2 files changed +0
-26
lines changed Expand file tree Collapse file tree 2 files changed +0
-26
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import axios from 'axios';
7
7
/**
8
8
* Internal Dependencies.
9
9
*/
10
- import { getPageOffset , PER_PAGE_FIRST , PER_PAGE_REST } from '../../../src/utils/pagination' ;
11
10
import { handleRedirectsAndReturnData } from '../../../src/utils/slug' ;
12
11
import { getPosts } from '../../../src/utils/blog' ;
13
12
import { HEADER_FOOTER_ENDPOINT } from '../../../src/utils/constants/endpoints' ;
Original file line number Diff line number Diff line change 1
- export const PER_PAGE_FIRST = 9 ; // No of posts to be shown on first page.
2
- export const PER_PAGE_REST = 12 ; // No of posts to be shown following page and after.
3
-
4
- export const getPageOffset = ( pageNo ) => {
5
-
6
- /**
7
- * Offset is how many posts are already shown ( meaning, after how many posts should we start qurying ).
8
- * @type {number }
9
- */
10
- let offset = 0 ;
11
- pageNo = Number ( pageNo ) ;
12
- if ( 1 === pageNo ) {
13
- offset = 0 ;
14
- } else if ( 2 === pageNo ) {
15
- offset = PER_PAGE_FIRST ;
16
- } else {
17
- offset = PER_PAGE_FIRST + ( ( pageNo - 2 ) * PER_PAGE_REST ) ;
18
- }
19
- return offset ;
20
- } ;
21
-
22
- export const totalPagesCount = ( totalPostsCount ) => {
23
- return Math . ceil ( ( totalPostsCount - PER_PAGE_FIRST ) / PER_PAGE_REST + 1 ) ;
24
- } ;
25
-
26
1
/**
27
2
* Create Pagination Links Array.
28
3
*
You can’t perform that action at this time.
0 commit comments