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

feat: Type pagination #15399

Merged
merged 10 commits into from
Mar 14, 2024
Merged

Conversation

Tresau
Copy link
Contributor

@Tresau Tresau commented Dec 15, 2023

Closes #13566

adds TypeScript types to Pagination and PaginationSkeleton. Depends on #15057

Changelog

  • TypeScript types for Pagination and PaginationSkeleton

Changed

  • .js -> .tsx and .ts extentions

Removed

  • N/A

Testing / Reviewing

Verify that unit test run, verify that storybook works as intended

@Tresau Tresau requested a review from a team as a code owner December 15, 2023 17:48
@Tresau Tresau marked this pull request as draft December 15, 2023 17:48

export interface PaginationPageSize {
text: string;
value: string;

Choose a reason for hiding this comment

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

Completely appreciate this is still a draft, but just to flag in the case it's helpful, based on this (and its display in the docs);

pageSizes: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.number),
PropTypes.arrayOf(
PropTypes.shape({
text: PropTypes.string,
value: PropTypes.number,
})
),
]).isRequired,

This might need to be a number

Suggested change
value: string;
value: number;

@Tresau Tresau marked this pull request as ready for review March 7, 2024 15:26
Copy link

netlify bot commented Mar 7, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit f8a7ffc
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/65f1ef980a60a9000867e1c7
😎 Deploy Preview https://deploy-preview-15399--v11-carbon-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 configuration.

@Tresau Tresau requested a review from a team as a code owner March 7, 2024 15:50
Comment on lines 508 to +514
pageSizes: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.number),
PropTypes.arrayOf(PropTypes.number.isRequired),
PropTypes.arrayOf(
PropTypes.shape({
text: PropTypes.text,
value: PropTypes.number,
})
text: PropTypes.string.isRequired,
value: PropTypes.number.isRequired,
}).isRequired
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since I updated text -> string, and needed to add some isRequired to fields to prevent typescript errors, I needed to update the public api snapshot accordingly. Not sure if this will cause this to needed to go out in a major change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. I don't think it will a problem!

@wkeese
Copy link
Contributor

wkeese commented Mar 12, 2024

Hopefully this can be merged soon, AFAIK it's the last Carbon problem preventing us from upgrading a bunch of our code to Carbon 11.

Copy link
Contributor

@andreancardona andreancardona left a comment

Choose a reason for hiding this comment

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

looks good to me - thank you for doing this!

Copy link
Contributor

@guidari guidari left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀
Thanks for the contribution!

Comment on lines 508 to +514
pageSizes: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.number),
PropTypes.arrayOf(PropTypes.number.isRequired),
PropTypes.arrayOf(
PropTypes.shape({
text: PropTypes.text,
value: PropTypes.number,
})
text: PropTypes.string.isRequired,
value: PropTypes.number.isRequired,
}).isRequired
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. I don't think it will a problem!

@guidari guidari added this pull request to the merge queue Mar 14, 2024
Merged via the queue into carbon-design-system:main with commit 9346f3e Mar 14, 2024
20 checks passed
preetibansalui pushed a commit to tay1orjones/carbon that referenced this pull request Apr 24, 2024
* feat: add types to Pagination

* refactor: update pageSizes proptype to correctly match interface

* test: update public snapshot since proptypes changed
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.

Add TypeScript types to Pagination, PaginationSkeleton
5 participants