diff --git a/gatsby-node.js b/gatsby-node.js index 8e3c3c9..2ebb979 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -28,7 +28,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => { } const posts = result.data.allMdx.edges; - const postsPerPage = 2; + const postsPerPage = 10; const numPages = Math.ceil(posts.length / postsPerPage); const rootPath = "/notes"; diff --git a/src/templates/notes.module.css b/src/templates/notes.module.css index 32eeb6e..6239ce1 100644 --- a/src/templates/notes.module.css +++ b/src/templates/notes.module.css @@ -1,4 +1,12 @@ .note-title { display: flex; justify-content: space-between; -} \ No newline at end of file +} + +.prev-page-link { + margin-right: 10px; +} + +.next-page-link { + margin-left: 10px; +} diff --git a/src/templates/notes.tsx b/src/templates/notes.tsx index 8b2a8d6..60f2f16 100644 --- a/src/templates/notes.tsx +++ b/src/templates/notes.tsx @@ -6,12 +6,12 @@ import style from "./notes.module.css"; export default ({ data, pageContext }) => { const posts = data.allMdx.edges; const { currentPage, numPages, rootPath } = pageContext; - let backElement = null; + let prevPageLink = null; if (currentPage === 2) { - backElement = <<; + prevPageLink = <<; } else if (currentPage !== 1) { - backElement = <<; + prevPageLink = <<; } return ( @@ -31,11 +31,11 @@ export default ({ data, pageContext }) => { ) })} -
- {backElement} -

{currentPage}

- {currentPage !== numPages ? >> : ''} -
+

+ {prevPageLink} + {currentPage} + {currentPage !== numPages && >>} +

) }