Skip to content

feat: Replace "Load More" button with Pagination System#681

Merged
sa-fw-an merged 4 commits intosugarlabs:mainfrom
Rahul-R79:feat/news-pagination
Jan 13, 2026
Merged

feat: Replace "Load More" button with Pagination System#681
sa-fw-an merged 4 commits intosugarlabs:mainfrom
Rahul-R79:feat/news-pagination

Conversation

@Rahul-R79
Copy link
Copy Markdown
Contributor

@Rahul-R79 Rahul-R79 commented Dec 26, 2025

📝 Description

Refactored the post navigation system in the News, Author, and Tag pages to significantly improve user experience and performance.

Previously, these pages utilized a "Load More" button which simply appended more items to the current list. This approach could lead to performance issues with large datasets and made it difficult for users to navigate to specific sections of the news feed.

This PR introduces the following changes:

  1. New Component: Created a reusable, responsive Pagination component (src/components/Pagination.tsx) featuring:
    Previous/Next navigation buttons. Smart page numbering with ellipses for large page counts. Active page highlighting with gradient styling. Smooth hover and click animations using framer-motion.

  2. News Page Refactor: Completely replaced the "Load More" logic in NewsPage.tsx with a page-based system. Implemented currentPage state management. Added auto-scroll to top on page change for better UX. Ensured filters (Search, Category) automatically reset the view to Page 1.

  3. Author & Tag Page Refactor: Applied the same pagination logic to AuthorPage.tsx and TagPage.tsx for a consistent experience across the site.

  4. Cleanup: Removed unused imports and icons associated with the legacy "Load More" button.

🔗 Related Issue

Fixes #672

🔄 Type of Change

  • 📱 New Feature (new page, component, or functionality)
  • 🎨 UI/UX Update (visual changes, styling improvements)
  • ⚡ Performance Improvement
  • 🧹 Code Refactoring

📷 Visual Changes

BEFORE

26.12.2025_18.05.42_REC.mp4
Screenshot 2025-12-26 180719

AFTER

26.12.2025_18.02.09_REC.mp4
Screenshot 2025-12-26 180658

@github-actions
Copy link
Copy Markdown

❌ Checks Failed

Status: 🚫 Not ready to merge

Please fix the following issues before merging:

📝 Code Linting Failed

Issue: Code formatting or style violations detected.

Specific problems:

• Code formatting issues detected

How to fix:

Platform Command Description
🐧 Unix/macOS/Linux npm run format Auto-fix all formatting issues
🪟 Windows npm run format:file <filename> Fix specific files
🔍 Check Only npm run format:check Check formatting without fixing

Need help with linting? Check out the Linting Guide for Windows Users for detailed instructions.


🛠️ Next Steps

  1. Fix the issues mentioned above
  2. Test locally to ensure everything works
  3. Push your fixes to this branch
  4. Wait for re-check - This bot will automatically run again

🤖 This comment will be updated automatically when you push new commits

@github-actions
Copy link
Copy Markdown

🎉 All Checks Passed!

Status: ✅ Ready to merge

✅ Completed Workflows

Workflow Status Details
🔨 Continuous Integration ✅ Passed Build completed successfully
📝 Code Linting ✅ Passed All formatting and style checks passed

🚀 This PR is ready for review and can be safely merged to main branch!

Great work! Your code meets all quality standards. 👏

@Rahul-R79
Copy link
Copy Markdown
Contributor Author

@FirePheonix I've implemented the new pagination feature to replace the "Load More" button across the News, Author, and Tag pages. The system is responsive and matches the site's design theme. All checks are green now please verify and merge when you get time!

Thankyou

Copy link
Copy Markdown

@mahesh-09-12 mahesh-09-12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Overall, this is a solid improvement, introducing a reusable Pagination component and integrating it across NewsPage and AuthorPage improves consistency and readability. The pagination logic is clear, responsive behavior is handled thoughtfully, and the UX feels aligned with the existing design.

I didn’t notice any functional regressions while reading through the changes. A couple of minor follow-ups that might be worth considering (non-blocking):

  • There is some repeated pagination-related logic across pages (e.g., handlePageChange, scroll-to-top behavior) that could potentially be abstracted later if this pattern grows.

  • It may be useful to add a short comment or doc note clarifying the mobile pagination behavior for future contributors.

Otherwise, this looks good from a code-quality and UX perspective 👍

@github-actions
Copy link
Copy Markdown

🎉 All Checks Passed!

Status: ✅ Ready to merge

✅ Completed Workflows

Workflow Status Details
🔨 Continuous Integration ✅ Passed Build completed successfully
📝 Code Linting ✅ Passed All formatting and style checks passed

🚀 This PR is ready for review and can be safely merged to main branch!

Great work! Your code meets all quality standards. 👏

@Rahul-R79
Copy link
Copy Markdown
Contributor Author

@mahesh-09-12 Thanks for the review! I've added the comment explaining the mobile pagination behavior as suggested.

Copy link
Copy Markdown

@mahesh-09-12 mahesh-09-12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update 👍
The added comments clearly explain the mobile pagination behavior and improve readability.
This looks good to me now.

@sa-fw-an
Copy link
Copy Markdown
Member

@Rahul-R79 I am not sure if this PR is to be merged or not. The PR looks good, but let me think for sometime if we really need a UI change.

@sa-fw-an sa-fw-an merged commit 75e997c into sugarlabs:main Jan 13, 2026
3 checks passed
@Rahul-R79 Rahul-R79 deleted the feat/news-pagination branch January 13, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: "Load More Articles” with Pagination in News Section

3 participants