reaviz / reablocks

🧩 Component Library for React based on Tailwind. Maintained by @goodcodeus.
https://reablocks.dev
Apache License 2.0
131 stars 10 forks source link

feat: add show on single page prop to Pager #263

Closed matsilva closed 3 weeks ago

matsilva commented 3 weeks ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

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?

[x] Yes
[ ] No

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 to false via the controls.

export const Default = ({ page = 0, size = 10, total = 100, ...rest }) => {
  return <Pager page={page} size={size} total={total} {...rest} />;
};
netlify[bot] commented 3 weeks ago

Deploy Preview for reablocks-storybook ready!

Name Link
Latest commit fa9456b3fc6bc8616cd7fd2b2723ac3e0fb715d0
Latest deploy log https://app.netlify.com/sites/reablocks-storybook/deploys/671a87c325e90f00086bcf55
Deploy Preview https://deploy-preview-263--reablocks-storybook.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 configuration.

amcdnl commented 3 weeks ago

released in latest