-
Notifications
You must be signed in to change notification settings - Fork 814
[V4] Use Tooltip inside of a Popover #235
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
Conversation
|
I'm wondering if this is a pattern we should even support (or encourage)? Curious about your thoughts on why we should pursue this @jeroenransijn ? |
src/popover/src/Popover.js
Outdated
|
|
||
| renderTarget = ({ getRef, isShown }) => { | ||
| const { children } = this.props | ||
| const isTooltipInside = children.type === Tooltip |
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.
Is it possible to not pass children? If so we may want to check that it exists first.
| .toString() | ||
| const getTooltipProps = appearance => { | ||
| switch (appearance) { | ||
| case 'card': |
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.
This might be a misunderstanding of the semantics, but I've often followed the rule of thumb that a Tooltip is simple, short content. It cannot contain html or other components, only strings. With those semantics, things that look like a raised "card" would qualify as a Popover IMO.
Not sure if this meshes with Evergreen's component semantics, but thought it was worth mentioning here (if it allows us to simplify things).
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.
The distinction currently between Tooltip and Popover is the interaction kind: hover vs. click. We might want to consider supporting something like <Popover interaction={InteractionKind.HOVER} /> similar to BlueprintJS at one point. I think we should leave that for a future major release.
src/tooltip/src/Tooltip.js
Outdated
| * This is an implementation detail. Please ignore. | ||
| * This is passed when a Tooltip is inside a Popover. | ||
| */ | ||
| popoverProps: PropTypes.object |
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.
I would omit it from the propTypes if this is meant for internal use only.
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.
It will throw a warning if it's not in propTypes right?
| @@ -1,12 +1,70 @@ | |||
| import React, { PureComponent } from 'react' | |||
| import PropTypes from 'prop-types' | |||
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.
Were these changes to ListItem intentional?
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.
I am not sure why this is showing up, since this is already in v4.
…o/evergreen into v4-tooltip-inside-popover
This PR implements the support of putting a
Tooltipinside of aPopover.Preview
Code Example
The above example is rendered by the following code.
Other additions
This PR also adds the support for 2 appearances on a
Tooltip:defaultandcard.