-
Notifications
You must be signed in to change notification settings - Fork 118
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(annotation): position custom rect_annotation tooltip by elastic-charts styles #247
feat(annotation): position custom rect_annotation tooltip by elastic-charts styles #247
Conversation
BREAKING CHANGE: this changes the type signature of `RectAnnotation.renderTooltip?` from `(position, details) => JSX.Element` to `(details) => JSX.Element`. This allows the user to pass in a custom element without having to do the heavy lifting of writing the container positioning styles themselves.
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
=======================================
Coverage 97.76% 97.76%
=======================================
Files 36 36
Lines 2641 2641
Branches 593 593
=======================================
Hits 2582 2582
Misses 52 52
Partials 7 7
Continue to review full report at Codecov.
|
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.
Tested locally, LGTM! 🎉
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.
Code LGTM
# [7.0.0](v6.3.0...v7.0.0) (2019-06-24) ### Features * **annotation:** simplify custom tooltip function ([#247](#247)) ([982bc63](982bc63)) ### BREAKING CHANGES * **annotation:** this changes the type signature of `RectAnnotation.renderTooltip?` from `(position, details) => JSX.Element` to `(details) => JSX.Element`. This allows the user to pass in a custom element without having to do the heavy lifting of writing the container positioning styles themselves.
🎉 This PR is included in version 7.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [7.0.0](elastic/elastic-charts@v6.3.0...v7.0.0) (2019-06-24) ### Features * **annotation:** simplify custom tooltip function ([opensearch-project#247](elastic/elastic-charts#247)) ([b191628](elastic/elastic-charts@b191628)) ### BREAKING CHANGES * **annotation:** this changes the type signature of `RectAnnotation.renderTooltip?` from `(position, details) => JSX.Element` to `(details) => JSX.Element`. This allows the user to pass in a custom element without having to do the heavy lifting of writing the container positioning styles themselves.
BREAKING CHANGE: this changes the type signature of
RectAnnotation.renderTooltip?
from(position, details) => JSX.Element
to(details) => JSX.Element
. This allows the user to pass in a custom element without having to do the heavy lifting of writing the container positioning styles themselves.Summary
Previously, the
renderTooltip?
property of aRectAnnotationSpec
was used in such a way that if defined, the returned component would be used instead of the default tooltip component to render the tooltip details. However, it was implemented in a way that required the user to also use the position information and write their own styles to position the tooltip correctly. This lends to a not great developer user experience when the user just wants to pass a custom component (as in the Storybook case where we just need to include an icon) because then the developer needs to write their own CSS styles to handle the position of the tooltip container itself.Instead, now we embed the custom component within the tooltip container so that the user does not need to worry about positioning. This also helps with making it so that the user still has customization capabilities while remaining some consistence with respect to the rest of the elastic-chart internal style.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] Any consumer-facing exports were added tosrc/index.ts
(and stories only import from../src
except for test data & storybook)