File tree 1 file changed +26
-2
lines changed
1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,14 @@ import MetaInfo from '../components/meta-info';
9
9
import Page from '../components/page' ;
10
10
import Lead from '../components/lead' ;
11
11
import theme from '../theme' ;
12
+ import Button from '../components/button' ;
12
13
13
- function Blog ( { data } ) {
14
+ function Blog ( { data, pageContext } ) {
15
+ const { currentPage, limit, numPages, skip } = pageContext
16
+ const isFirst = currentPage === 1
17
+ const isLast = currentPage === numPages
18
+ const prevPage = currentPage - 1 === 1 ? "" : ( currentPage - 1 ) . toString ( )
19
+ const nextPage = ( currentPage + 1 ) . toString ( )
14
20
return (
15
21
< Layout >
16
22
< Helmet >
@@ -36,7 +42,25 @@ function Blog({ data }) {
36
42
< Lead > { node . frontmatter . description } </ Lead >
37
43
</ article >
38
44
) ) }
39
- { /* TODO: pagination */ }
45
+ < div css = { css `
46
+ display: flex;
47
+ justify-content: space-between;
48
+ ` } >
49
+ { ! isFirst && (
50
+ < Button href = { `/blog/${ prevPage } ` } rel = "prev" className = 'primary' css = { css `
51
+ margin: ${ theme . space [ 4 ] } 0;
52
+ ` } >
53
+ ← Previous Page
54
+ </ Button >
55
+ ) }
56
+ { ! isLast && (
57
+ < Button href = { `/blog/${ nextPage } ` } rel = "next" className = 'primary' css = { css `
58
+ margin: ${ theme . space [ 4 ] } 0;
59
+ ` } >
60
+ Next Page →
61
+ </ Button >
62
+ ) }
63
+ </ div >
40
64
</ Container >
41
65
</ Page >
42
66
</ Layout >
You can’t perform that action at this time.
0 commit comments