-
Notifications
You must be signed in to change notification settings - Fork 46
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
#2170 Toolbar (toolbarConfig) to support Toggletip, and it should popup like tooltip (shows up when mouse hover on it) #2171
Conversation
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
@@ -30,7 +30,7 @@ | |||
line-height: 1.2; | |||
text-align: left; | |||
z-index: 10000; // Modal layout has z-index 9000. Show tooltip on top of modal. | |||
pointer-events: none; | |||
// pointer-events: none; |
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.
If this is not needed it should be deleted not commented out. (Note: There shouldn't be any commented out code merged into main unless there is a comment to indicate why the code is commented out.)
showToolTipOnClick: PropTypes.bool | ||
showToolTipOnClick: PropTypes.bool, | ||
hoverable: PropTypes.bool, // if true, can hover over to the tooltip, instead of immedieatly disappearing. | ||
inTooltip: PropTypes.bool |
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.
You are declaring inTooltip
here as a prop for the Tooltip object but you are using it as this.inTooltip
. There's a difference between a prop and member variables of a React object. You should remove this from here and declare this.inTooltip
in the constructor -- with a comment to explain the purpose of the variable. (Note: it's not strictly necessary to declare it, since it will default to undefined (falsey) when you first use it, but declaring in in the constructor given you the opportunity to comment on its usage)
@@ -154,7 +154,6 @@ class ToolTip extends React.Component { | |||
} | |||
|
|||
showTooltipWithDelay() { | |||
|
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.
Unless you have a really good reason, you should avoid removing (or adding) empty lines in the code you are not altering as part of your PR.
@@ -356,7 +355,19 @@ class ToolTip extends React.Component { | |||
if (this.props.children) { | |||
// when children are passed in, tooltip will handle show/hide, otherwise consumer has to hide show/hide tooltip | |||
const mouseover = () => this.setTooltipVisible(true); | |||
const mouseleave = () => this.setTooltipVisible(false); | |||
// const mouseleave = () => this.setTooltipVisible(false); |
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 that i snot needed should be removed not commented out. (Note: There shouldn't be any commented out code merged into main unless there is a comment to indicate why the code is commented out.)
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
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 made some minor comments.
<Button kind="danger" size="sm" style={ { width: "30px", height: "10px" } }>Reload</Button> | ||
</div> | ||
</div> | ||
} |
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.
Can you pull out this JSX for the tooltip and assign it to a variable above (like the way subMenuTextSize and subMenuSize are created and then just include the variable here?
@@ -35,6 +35,7 @@ class ToolTip extends React.Component { | |||
this.tabKeyPressed = false; | |||
// Tooltip should not close if link inside tooltip is clicked. | |||
this.linkClicked = false; | |||
this.inTooltip = false; // A boolean variable that determines if the cursor is in the 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.
Sorry to be picky -- this should say '... cursor is over the tooltip'
@@ -522,14 +541,16 @@ ToolTip.propTypes = { | |||
showToolTipIfTruncated: PropTypes.bool, // Set to true to only display tooltip if full text does not fit in displayable width | |||
truncatedRef: PropTypes.object, | |||
delay: PropTypes.number, | |||
showToolTipOnClick: PropTypes.bool | |||
showToolTipOnClick: PropTypes.bool, | |||
hoverable: PropTypes.bool, // If true, can hover over to the tooltip, instead of immediately disappearing. |
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.
Sorry picky again. Please change to: "If true, mouse cursor can be hovered over to the tooltip."
Signed-off-by: Michael Pavlik <[email protected]>
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.
LGTM
Fixes: #2170
Developer's Certificate of Origin 1.1