-
-
Notifications
You must be signed in to change notification settings - Fork 11
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: add show on single page prop to Pager #263
Conversation
✅ Deploy Preview for reablocks-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
src/data/Pager/Pager.tsx
Outdated
@@ -123,7 +133,7 @@ export const Pager: FC<PagerProps> = ({ | |||
} | |||
}, [canNext, page, onPageChange, pageCount]); | |||
|
|||
if (pageCount === 1) { | |||
if (hideOnSinglePage && pageCount === 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.
I think it would be better to just remove this logic and the user can deteremine if they want to do this themselves. If you just want to remove this check, we can push a release for ya.
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 think it would be better to just remove this logic and the user can deteremine if they want to do this themselves.
This makes sense.
If you just want to remove this check, we can push a release for ya.
There is an ask to show the pagination at all times, so that would be great 👍
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.
Let me know what you want me to do here.
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.
Ya, just delete that if statement/additions and lgtm.
released in latest |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently, when pageCount === 1, the content is always hidden. There is no option to override this behavior.
Issue Number: N/A
What is the new behavior?
A new optional boolean flag showOnSinglePage has been introduced. When set to true, shows the pager even if there is only one page. If defaults to false and keeps the existing behavior in tact.
Does this PR introduce a breaking change?
Other information
I did not include it in this pr, but I used the following storybook story to easily test the changes. You just need to set total to 10 and set
hideOnSinglePage
tofalse
via the controls.