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

[feature]: Add a Pagination.jsx component #224

Open
gbowne1 opened this issue May 24, 2023 · 5 comments
Open

[feature]: Add a Pagination.jsx component #224

gbowne1 opened this issue May 24, 2023 · 5 comments
Labels
design feature This should be a new feature. frontend This is a frontend issue or PR good first issue Good for newcomers help wanted Extra attention is needed medium-complexity This issue is medium complexity medium-priority

Comments

@gbowne1
Copy link
Owner

gbowne1 commented May 24, 2023

Is your feature request related to a problem? Please describe.

Yes and no.

Some of the items in /pages may need some form of pagination for displaying more than a few items, like Events, Groups and Friends.. which are part of our core, so make this semi-reusable between layouts, pages and components.

Describe the solution you would like

This should be elaborated upon, but it ideally should be something like this:

import { Box, Button } from '@mui/material';

const Pagination = ({
  currentPage,
  setCurrentPage,
  recordsPerPage,
  totalRecords,
}) => {
  const nPages = Math.ceil(totalRecords / recordsPerPage);

  const pageNumbers = [...Array(nPages + 1).keys()].slice(1);

  const nextPage = () => {
    if (currentPage !== nPages) setCurrentPage(currentPage + 1);
  };

  const prevPage = () => {
    if (currentPage !== 1) setCurrentPage(currentPage - 1);
  };

  return (
    <Box>
      <Button onClick={prevPage}>Prev</Button>
      {pageNumbers.map((number) => {
        return (
          <Button
            key={number}
            onClick={() => setCurrentPage(number)}
            variant={number === currentPage ? 'contained' : 'outlined'}
          >
            {number}
          </Button>
        );
      })}
      <Button onClick={nextPage}>Next</Button>
    </Box>
  );
};

export default Pagination;

Describe the alternatives you have tried

Some social media apps and sites are using some minor forms of pagination in various forms already, so it seems useful to help display many items.

Additional context

No response

@gbowne1 gbowne1 added enhancement New feature or request help wanted Extra attention is needed labels May 24, 2023
@gbowne1 gbowne1 added this to the Front End milestone May 24, 2023
@gbowne1
Copy link
Owner Author

gbowne1 commented May 24, 2023

I feel like this in particular will be useful in the current Events feature and perhaps in other core features we have like Friends and Groups.

@gbowne1 gbowne1 modified the milestones: Front End, Posting & Sharing Jun 5, 2023
@gbowne1 gbowne1 added frontend This is a frontend issue or PR design high-priority medium-priority needs-testing This needs testing high-complexity This issue is an advanced complexity issue medium-complexity This issue is medium complexity feature This should be a new feature. labels Jun 8, 2023
@gbowne1 gbowne1 added the hacktoberfest The hacktoberfest label label Oct 4, 2023
@LaPulgaaa
Copy link

@gbowne1 I find this issue/addition interesting and would love to work on it .May you please assign it to me .further what are your suggestions on using pagination component built in from material ui.something like:

<Pagination count={number of pages} page={page} onChange={handleChange} />

@gbowne1
Copy link
Owner Author

gbowne1 commented Oct 23, 2023

@LaPulgaaa We have not decided where this component would be useful just yet or even where it will appear in the UI. I would think it would be best used in something that would need several pages.

That being said, we need to have more features in place for this to be useful yet.

@balajik @gbowne1 @manuel12 @pawel975

@LaPulgaaa
Copy link

LaPulgaaa commented Oct 23, 2023

thanks for the response .can you mention some of the features that can be worked on . I am looking for opportunities to contribute to issue under hacktoberfest labels @gbowne1

@gbowne1
Copy link
Owner Author

gbowne1 commented Oct 23, 2023

@LaPulgaaa

Anything in this link is available:

https://github.com/gbowne1/reactsocialnetwork/issues

There's 33 issues, two whole pages of issues. Have a look through them. I did not mark them all hacktoberfest.

@gbowne1 gbowne1 removed enhancement New feature or request help wanted Extra attention is needed frontend This is a frontend issue or PR design high-priority medium-priority needs-testing This needs testing high-complexity This issue is an advanced complexity issue medium-complexity This issue is medium complexity labels Feb 21, 2024
@gbowne1 gbowne1 added help wanted Extra attention is needed good first issue Good for newcomers frontend This is a frontend issue or PR design medium-priority medium-complexity This issue is medium complexity feature This should be a new feature. and removed feature This should be a new feature. hacktoberfest The hacktoberfest label labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design feature This should be a new feature. frontend This is a frontend issue or PR good first issue Good for newcomers help wanted Extra attention is needed medium-complexity This issue is medium complexity medium-priority
Projects
Development

No branches or pull requests

2 participants