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

fix(react/pagination): render page number twice when pagesUnknown #12302

Merged

Conversation

61130061
Copy link
Contributor

@61130061 61130061 commented Oct 14, 2022

Closes #12252

According to #12252, when pagesUnknown is true, pagination render page number as same as selector which does not make sense to render this information twice as shown in figure before. So, I change page number (pageText) to page label in front of the selector which makes more sense and make pagination looks cleaner. Also, change pageText prop from function to string so user can change the page label.

before:
before_figure

after:
after_figure

Changelog

New

  • {{new thing}}

Changed

  • hide/show page label and total page number depend on pagesUnknown
  • pageText default change to page
  • typeof pageText change from function to string
  • test case of pagination pagesUnknown = true change to expect just page since switch from page number to page label as shown in figures
  • change border-left style form selector to pagination__right

Removed

  • {{removed thing}}

Testing / Reviewing

  • All test passed!

According to carbon-design-system#12252, when pagesUnknown is , pagination render page
number as same as selector which does not make sense to render this information twice.
So, I change page number (pageText) to page label in front of
the selector which makes more sense and make pagination looks cleaner.

BREAKING CHANGE: typeof pageText change from function to string.
@61130061 61130061 requested review from a team as code owners October 14, 2022 14:03
@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2022

DCO Assistant Lite bot All contributors have signed the DCO.

@61130061 61130061 changed the title fix(react/pagination): render page number twice when pagesUnknown #12252 fix(react/pagination): render page number twice when pagesUnknown Oct 14, 2022
@netlify
Copy link

netlify bot commented Oct 14, 2022

Deploy Preview for carbon-components-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2756279
🔍 Latest deploy log https://app.netlify.com/sites/carbon-components-react/deploys/6373a1f81e692100085a5cde
😎 Deploy Preview https://deploy-preview-12302--carbon-components-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@61130061
Copy link
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@netlify
Copy link

netlify bot commented Oct 14, 2022

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 2756279
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/6373a1f8938dc30009719a2c
😎 Deploy Preview https://deploy-preview-12302--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@tw15egan
Copy link
Collaborator

@61130061 We'll need to keep this a function so that teams can pass down a function for translation keys. I think this can be fixed just by passing down pageText={() => ''} to the Pagination component as-is. It seems like there is a slight styling issue in this scenario, but can be fixed by just adding the following CSS to _pagination.scss

.#{$prefix}--pagination__right .#{$prefix}--pagination__text:empty {
    margin: 0;
}

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small suggested change, but overall this looks good to me. Thanks for contributing this fix!

@61130061 There are conflicts that need resolved before this can be merged

@61130061
Copy link
Contributor Author

@tay1orjones Thank you for your approval and suggestion! I commit another Pagination.js with the same problem. I think all conflicts are resolved now.

@tay1orjones tay1orjones requested review from tw15egan and removed request for jnm2377 October 21, 2022 19:17
@tay1orjones
Copy link
Member

@61130061 There's still some merge conflicts here

@tay1orjones
Copy link
Member

I just fixed the merge conflicts.

@tw15egan the merge was a bit hairy, but I think I got it all. Could you review again once the deploy preview is updated?

Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the merge was correct, I think these two just got added back in inadvertently

@@ -0,0 +1,421 @@
/**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this file was removed in #12115

@tay1orjones
Copy link
Member

@tw15egan Thanks for the catch - I just pushed a commit to remove those files

@kodiakhq kodiakhq bot merged commit 7650c77 into carbon-design-system:main Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: Pagination shows redundant information when pagesUnknown is set to true.
4 participants