-
Notifications
You must be signed in to change notification settings - Fork 463
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
[Backoffice] Update in page pagination UIs vs functionalities #1269
base: main
Are you sure you want to change the base?
Conversation
Hi @HnKnA, I’ve been reading through your implementation, and I think it's coming along well. I have a suggestion regarding the pagination controls that you might want to consider: Currently, we have states and their handlers (e.g., For example: paginationControls?: {
itemsPerPage: {
value; //this is the current itemsPerPage state,
onChange; //this is the current onItemsPerPageChange method,
},
goToPage: {
value; //goToPage,
onChange; //onGoToPageChange,
onSubmit; //onGoToPageSubmit,
}
} Alternatively, if we need to keep |
I prefer the approach of grouping related variables, and I will configure them today. |
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.
Hi @HnKnA, I’ve noted a few points for potential refactoring that you can consider. When you have time, could you please take a look and let me know if they make sense? Thank you!
backoffice/styles/globals.css
Outdated
@@ -90,6 +90,29 @@ a { | |||
background-color: black; | |||
} | |||
|
|||
.pagination-helper { |
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.
We should move pagination css to Pagination.module.css.
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.
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.
Thanks for addressing the feedback.
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.
Should create common/hooks and put this hook function to file usePaganation.ts.
Additionally, update the tsconfig.json to add a path alias for @commonHooks pointing to the common/hooks directory.
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.
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, thanks. Please update optional param for usePagination and we can close this.
import { useState, useMemo, useCallback } from 'react'; | ||
import { DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE } from '@constants/Common'; | ||
|
||
export const PAGE_SIZE_OPTION = [5, 10, 15, 20]; |
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.
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’ve updated the code to move PAGE_SIZE_OPTION
to the common constants file
} | ||
|
||
const usePagination = ({ | ||
initialPageNo = DEFAULT_PAGE_NUMBER, |
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.
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.
The usePagination
hook has been updated to make the arguments optional, with default values set for initialPageNo
and initialItemsPerPage
. Let me know if there’s anything else you’d like to adjust.
|
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.
Thank you for addressing the feedback! Approved.
Use 'Enter' click to submit the page change
Pagination_Update.online-video-cutter.com.1.mp4