Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/pagination-visibilty when no results found #1103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sohailk12
Copy link

@sohailk12 sohailk12 commented Aug 9, 2024

Description

Fixes: Issue #1092 when the user searches for a specific name the pagination is still visible and if there are less than 20 profiles in the list the pagination is still visible

Related Issues

when the user searches for a name and the list is less than 20 the pagination should be hidden

Changes Proposed

Applied a condition in app.js file if the length of profiles array is greater than 20 only then the pagination is visible

Checklist

  • [ x] I have read and followed the Contribution Guidelines.
  • [x ] All new and existing tests passed.
  • [x ] I have updated the documentation to reflect the changes I've made.
  • [x ] My code follows the code style of this project.
  • [x ] The title of my pull request is a short description of the requested changes.

Screenshots

image

0809.mp4

Note to reviewers

Please review my code and if it is helpful do let me know

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Great job, @sohailk12! 🎉 Thank you for opening a pull request. Your contribution is valuable and we appreciate your efforts to improve our project.

Soon the maintainers/owner will review it and provide you with feedback/suggestions.

Copy link

vercel bot commented Aug 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dev-find ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2024 7:23am

@dylan-dot-c
Copy link
Contributor

Thanks for fixing the issue I brought up, only thing is that you might want to remove the console.log() from production code and for here in App.js
{profiles.length >= recordsPerPage ? ( <Pagination currentPage={currentPage} totalPages={Math.ceil((searching ? profiles.length : shuffledProfiles.length) / recordsPerPage)} onNextPage={handleNextPage} onPrevPage={handlePrevPage} /> ) : ( '' )}

you can just use && to render the pagination since there is nothing to render if pagination is not shown

so like
(profiles.length >= recordsPerPage) && <Pagination {...} />

@dylan-dot-c
Copy link
Contributor

Hopefully they get your pr merged soon

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.

2 participants