-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Pagination component #690
Conversation
This pull request has been linked to Shortcut Story #523: Add pagination to article list page. |
…f-portal-client into sc-523/article-pagination
Dockerfile
Outdated
@@ -3,13 +3,13 @@ | |||
FROM node:14.19.3-slim AS builder | |||
|
|||
RUN apt-get update \ | |||
&& apt-get -y --no-install-recommends install openssl libc6 | |||
&& apt-get -y --no-install-recommends install openssl libc6 git ca-certificates |
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.
@esacteksab now that we have a released version of react uswds, is it ok to keep the changes you made? or do we need to revert?
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.
revert please. I'm happy to do this here or on another branch. Which would you like?
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.
here is best since they haven't been merged in yet!
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 believe it's done.
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.
Changes look good. I left some minor comments, nothing blocking. I haven't done the a11y
review yet but wanted the comments shared now in case I don't finish the a11y
checks before you look at the PR again.
Dockerfile
Outdated
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN yarn install --frozen-lockfile | ||
RUN rm yarn.lock && yarn install --frozen-lockfile --network-concurrency 1 |
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.
suggestion: I'll defer to Barry here, but I think we can revert these now that react-uswds
is released. Especially since this line removes the yarn.lock
file that we have checked in which isn't ideal, though should have little effect since our package.json is locked down.
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.
Reverted
{pagination && ( | ||
<Pagination | ||
pathname={window.location.pathname} | ||
totalPages={pagination.totalPages} | ||
currentPage={pagination.currentPage} | ||
/> | ||
)} |
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.
nit-pick(non-blocking): Can you add a test to ArticleList.test.tsx
to verify that if pagination
props are passed in that the <Pagination />
component is included and has the expected props?
If it's too much trouble then feel free to skip.
}: { | ||
pathname: string | ||
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.
nit-pick(non-blocking): Can you remove this empty line?
// If no query or an invalid param, return page 1 | ||
const currentPage = parseInt(context.query.page) || 1 | ||
|
||
const articlesPerPage = 10 |
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.
Question: I wonder if this should be a param in the future? So that we can adjust the items per page. Nothing to do in this PR just future thoughts.
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.
LGTM.
question: I don't see an e2e test. Will you be adding one? Though that maybe simpler once we have the data seed stuff figured out. I'll approve since this isn't blocking for me but let me know if you add an e2e test that you want me to review.
Dockerfile
Outdated
@@ -27,9 +27,6 @@ RUN yarn install --production --ignore-scripts --prefer-offline | |||
# E2E image for running tests (same as prod but without certs) | |||
FROM node:14.19.3-slim AS e2e | |||
|
|||
RUN apt-get update \ | |||
&& apt-get -y --no-install-recommends install openssl libc6 |
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.
@esacteksab is this expected to have this PR remove all of this? or am i missing something? just don't want to delete anything important..
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.
That was definitely a miss for me. I put it back. Thank you for catching this.
@gidjin I went ahead and added an e2e test for the ORBIT Blog page that is essentially a placeholder until we get some CMS data. But feels better to have one in place with a TODO note, even if incomplete. |
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.
LGTM!
// TODO: Once we have data in CMS test db, we can test | ||
// that articles and pagination are working as expected. |
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.
Praise: good idea on having a place holder with a TODO, should make coming back later to add the test easier to find.
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.
Looks good!
## [4.5.0](4.4.0...4.5.0) (2022-07-29) ### Features * Add link to ORBIT Blog on portal ([#719](#719)) ([7ce6af9](7ce6af9)) * Create internal news page and update existing external news page ([#711](#711)) ([feadcae](feadcae)) * Edit display name ([#706](#706)) ([372ad2a](372ad2a)) * Pagination component ([#690](#690)) ([bc20cd5](bc20cd5))
SC-523
Do not be fooled by the charming avatar. This PR now belongs to @abbyoung 💀
To Do
Proposed changes
Reviewer notes
You can view the pagination component on a page by visiting
/about-us/orbit-blog
, but what displays will depend on how many published ORBITBlog articles are in the db.I've added some test articles to the dev environment so you should see more than one page. If you want to see more, you'll need to add and publish more articles in the cms.
You can also view the component on Storybook and use the sandbox to test how it will behave visually with different inputs.
Setup
Locally:
In ussf-portal-client,
yarn services:up && yarn dev
In ussf-portal-cms,
yarn dev
You'll need to populate db with articles in ORBITBlog category to see paginated results on
/about-us/orbit-blog
To view Storybook, run
yarn storybook
in ussf-portal-client and view the Pagination components.Code review steps
As the original developer, I have
As code reviewer(s), I have
As a designer reviewer, I have
As a test user, I have
Screenshots