-
-
Notifications
You must be signed in to change notification settings - Fork 27
feat: Added Pagination to the Resources Page #166
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
Conversation
YAY thank you for putting up this draft, @pdotsani! Do you need help getting the merge conflicts fixed? Separately, I'll tag this as |
Also, I won't review this until this is out of draft mode. |
16f459b
to
02c291c
Compare
02c291c
to
4c54a76
Compare
@lpatmo Looks like a rebase fixed all the conflicts. Should be good for a review. |
@@ -0,0 +1,95 @@ | |||
import React, { useState } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file can be removed in favor of src/pages/Resources/Resources.js
, right?
src/pages/Resources/Resources.js
Outdated
getResources | ||
); | ||
const [goToPage, setGoToPage] = useState(); | ||
const [isPagination, triggerPagination] = useState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was tempted to ask that this be renamed paginate, setPaginate
for consistency's sake, but triggerPagination
has a certain ring to it 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, thinking we should initialize the value to be null: useState();
src/pages/Resources/Resources.js
Outdated
@@ -58,6 +67,18 @@ function Resources() { | |||
</Typography> | |||
)} | |||
<br /> | |||
<Pagination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/pages/Resources/Resources.js
Outdated
@@ -58,6 +67,18 @@ function Resources() { | |||
</Typography> | |||
)} | |||
<br /> | |||
<Pagination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UI nitpick: what do you think about moving the pagination component to the bottom of the grid? :)
🎉 Functionality works and you've figured out how to work with https://material-ui.com/components/pagination/, which is great! Left a few comments re: minor details like:
Thanks @pdotsani! Happy to discuss more in threads if you want to push back or have questions |
let params; | ||
|
||
if (isPagination) { | ||
params = `?page=${goToPage}`; | ||
} else { | ||
params = `?search=${searchValue}`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let params; | |
if (isPagination) { | |
params = `?page=${goToPage}`; | |
} else { | |
params = `?search=${searchValue}`; | |
} | |
const params = isPagination? `?page=${goToPage}` : `?search=${searchValue}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion, @turretd!
…agination component when there is no search term, and moved it down on the page
What type of PR is this? (check all applicable)
Context
Closes issue #104
Screenshots/Recordings (if there are UI changes)
Implementation Details - what was your thought process as you changed the code?
Added tests?
Added to documentation (readme.md or contributing.md)?