-
Notifications
You must be signed in to change notification settings - Fork 60
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
Feature/add tooltip component #176
Conversation
b06bde1
to
6b51edf
Compare
4c3a407
to
3d1672c
Compare
ee676fb
to
4e8ec02
Compare
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.
Hey @celineung,
Thank you for your work! 😊 here is my review.
src/Tooltip.tsx
Outdated
"aria-describedby": string; | ||
className?: string; | ||
}; | ||
TooltipOwnerButtonComponent?: JSX.Element; |
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.
TooltipOwnerButtonComponent?: JSX.Element; | |
button?: JSX.Element; |
This is not a component; it's a node. Therefore, it shouldn't be capitalized.
Additionally, I think the API could benefit from a redesign. Whether the button is undefined or not should be inferred from the parameters. If a button exists, then tooltipOwnerProps has no reason to be prsent on the return type. Also, it's somewhat confusing from the user's perspective to have to both mount a node and a component. Ideally, they should just have to use a single TooltipButton with a label
and a tooltip
prop or something similar.
When designing an API, it's crucial to consider the user's perspective. What makes the most sense for them. What design would constiture a better (DX). The implementation details are secondary; the primary focus should be on fulfilling the API design.
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.
Hi @garronej, thank you for your review :)
I updated the PR and made a new suggestion for the Tooltip Component.
4e8ec02
to
461a3a4
Compare
461a3a4
to
f888e94
Compare
Hi @garronej , I think @celineung has taken your suggestions into account and is waiting for your review |
Oh yes sorry! |
Hi @celineung, Thank you for your contribution. The idea of applying the id to child elements is more effective than my initial suggestion. I also appreciate the inclusion of type-level tests.
I've opened a new PR. Thanks for your efforts on this. If you have the time and interest to make these adjustments, that would be great. However, I understand that open-source contributions can be time-consuming, so no pressure to follow up if you can't. Your willingness to contribute is already appreciated. |
Add tooltip component
See DSFR doc