Skip to content

Commit 7e2ccf5

Browse files
committed
pagination navigation fix #1946
1 parent 207dd6c commit 7e2ccf5

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

pages/blog/index.page.tsx

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -316,37 +316,8 @@ export default function StaticMarkdownPage({
316316
</span>
317317
</div>
318318

319-
{/* pagination control */}
320-
<div className='flex justify-center items-center gap-4 my-5'>
321-
<button
322-
className={`px-4 py-2 rounded-md font-semibold ${
323-
currentPage === 1
324-
? 'bg-gray-300 dark:bg-slate-600 cursor-not-allowed'
325-
: 'bg-blue-600 text-white hover:bg-blue-700'
326-
}`}
327-
disabled={currentPage === 1}
328-
onClick={() => setCurrentPage((p) => p - 1)}
329-
>
330-
Previous
331-
</button>
332-
<span className='text-lg font-medium dark:text-white'>
333-
Page {currentPage} of {totalPages}
334-
</span>
335-
<button
336-
className={`px-4 py-2 rounded-md font-semibold ${
337-
currentPage === totalPages
338-
? 'bg-gray-300 dark:bg-slate-600 cursor-not-allowed'
339-
: 'bg-blue-600 text-white hover:bg-blue-700'
340-
}`}
341-
disabled={currentPage === totalPages}
342-
onClick={() => setCurrentPage((p) => p + 1)}
343-
>
344-
Next
345-
</button>
346-
</div>
347-
348319
{/* Blog Posts Grid */}
349-
<div className='grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5 gap-6 grid-flow-row mb-20 bg-white dark:bg-slate-800 mx-auto p-4'>
320+
<div className='grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5 gap-6 grid-flow-row mb-16 bg-white dark:bg-slate-800 mx-auto p-4'>
350321
{currentPagePosts.map((blogPost: any, idx: number) => {
351322
const { frontmatter, content } = blogPost;
352323
const date = new Date(frontmatter.date);
@@ -477,6 +448,34 @@ export default function StaticMarkdownPage({
477448
);
478449
})}
479450
</div>
451+
{/* pagination control */}
452+
<div className='flex justify-center items-center gap-4'>
453+
<button
454+
className={`px-4 py-2 rounded-md font-semibold ${
455+
currentPage === 1
456+
? 'bg-gray-300 dark:bg-slate-600 cursor-not-allowed'
457+
: 'bg-blue-600 text-white hover:bg-blue-700'
458+
}`}
459+
disabled={currentPage === 1}
460+
onClick={() => setCurrentPage((p) => p - 1)}
461+
>
462+
Previous
463+
</button>
464+
<span className='text-lg font-medium dark:text-white'>
465+
Page {currentPage} of {totalPages}
466+
</span>
467+
<button
468+
className={`px-4 py-2 rounded-md font-semibold ${
469+
currentPage === totalPages
470+
? 'bg-gray-300 dark:bg-slate-600 cursor-not-allowed'
471+
: 'bg-blue-600 text-white hover:bg-blue-700'
472+
}`}
473+
disabled={currentPage === totalPages}
474+
onClick={() => setCurrentPage((p) => p + 1)}
475+
>
476+
Next
477+
</button>
478+
</div>
480479
</div>
481480
</SectionContext.Provider>
482481
);

0 commit comments

Comments
 (0)