-
Notifications
You must be signed in to change notification settings - Fork 825
Charts: Refactor withResponsive
HOC to Allow Custom Responsive Config for Chart Component
#43871
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
Charts: Refactor withResponsive
HOC to Allow Custom Responsive Config for Chart Component
#43871
Conversation
- Introduced `maxWidth`, `aspectRatio`, and `resizeDebounceTime` properties across BarChart, LineChart, PieChart, and PieSemiCircleChart story files. - Updated the `withResponsive` higher-order component to utilize these new properties for better responsive behavior. - Enhanced tests to validate the application of these new configurations.
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
|
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.
Works as described 👍
…ig for Chart Component (#43871) * Add responsive configuration options for charts - Introduced `maxWidth`, `aspectRatio`, and `resizeDebounceTime` properties across BarChart, LineChart, PieChart, and PieSemiCircleChart story files. - Updated the `withResponsive` higher-order component to utilize these new properties for better responsive behavior. - Enhanced tests to validate the application of these new configurations. * changelog
Fixes CHARTS-28
Proposed changes:
Previously, all chart components were exported only as versions wrapped with the
withResponsive
higher-order component (HOC), with responsive configuration (e.g., aspectRatio, maxWidth, resizeDebounceTime) set statically at the time of wrapping. This prevented consumers from customizing responsive behavior for their specific use cases.This PR refactors the
withResponsive
HOC to allow consumers to pass custom responsive configuration props (aspectRatio, maxWidth, resizeDebounceTime, etc.) directly to the wrapped chart components. Now, consumers can easily adjust responsive behavior per instance.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Screen.Recording.2025-06-10.at.15.46.00.mov