nashtech-garage / yas

YAS: Yet Another Shop, a sample microservices project in Java
MIT License
1.61k stars 419 forks source link

[Backoffice] Update in page pagination UIs vs functionalities #1269

Open HnKnA opened 1 week ago

HnKnA commented 1 week ago

Use 'Enter' click to submit the page change

https://github.com/user-attachments/assets/b8ad93a4-4fbe-4ea7-9f28-4e6a0dab1540

mochacr0 commented 4 days ago

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., itemsPerPage with onItemsPerPageChange, and goToPage with onGoToPageChange/onGoToPageSubmit) that seem tightly coupled and are often used together. To ensure consistency and reduce the risk of mismatches, I suggest grouping related states and handlers into a single prop, such as a paginationControls object. This would make it clear that these values should always be passed together.

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 itemsPerPage and goToPage separate, we could consider structuring them as distinct control props (itemsPerPageControl and goToPageControl). How do you think?

HnKnA commented 4 days ago

I prefer the approach of grouping related variables, and I will configure them today.

sonarcloud[bot] commented 1 day ago

Quality Gate Passed Quality Gate passed for 'backoffice'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud