HHS / simpler-grants-gov

https://simpler.grants.gov
Other
31 stars 9 forks source link

[Bug]: Unbounded pagination shows extra pagination pages #1965

Closed rylew1 closed 1 month ago

rylew1 commented 1 month ago

Summary

      <Pagination
        pathname="/search"
        currentPage={page}
        // totalPages={totalPages} // this was removed to make this component "unbounded"
        maxSlots={MAX_SLOTS} // constant set to 5
        onClickNext={() => handlePageChange(page + 1)}
        onClickPrevious={() => handlePageChange(page - 1)}
        onClickPageNumber={(event, page) => handlePageChange(page)}
      />

When we removed the totalPages prop from being passed into SearchPagination in order to make the component "unbounded" - I believe this impacts the number of pages shown in the SearchPagination component when the results are less then the number of MAX_SLOTS (set to 5)

For example -

image

So we do need to manually calculate a totalPages if the number of pages is less than 3 I believe.

Acceptance criteria

rylew1 commented 1 month ago

cc @andycochran if you have a moment can you take a peek at this?

andycochran commented 1 month ago

Brainstorming options: https://betagrantsgov.slack.com/archives/C05TGEL3C6Q/p1715213399388129

rylew1 commented 1 month ago
.usa-component {
  font-family: family('ui');
  font-size: size('ui', $theme-body-font-size);
  line-height: line-height('ui', $theme-body-line-height);
}