Skip to content
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

Merged
merged 10 commits into from
Sep 26, 2024

Conversation

mikieyx
Copy link
Contributor

@mikieyx mikieyx commented Sep 23, 2024

Fixes: #2170

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

Michael Pavlik added 3 commits September 23, 2024 09:10
@mikieyx mikieyx requested a review from tomlyn September 23, 2024 16:29
@@ -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;
Copy link
Member

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
Copy link
Member

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)

canvas_modules/common-canvas/src/tooltip/tooltip.jsx Outdated Show resolved Hide resolved
@@ -154,7 +154,6 @@ class ToolTip extends React.Component {
}

showTooltipWithDelay() {

Copy link
Member

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);
Copy link
Member

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.)

Michael Pavlik and others added 3 commits September 23, 2024 12:55
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
Signed-off-by: Michael Pavlik <[email protected]>
@mikieyx mikieyx requested a review from tomlyn September 25, 2024 16:33
Copy link
Member

@tomlyn tomlyn left a 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>
}
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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."

@mikieyx mikieyx requested a review from tomlyn September 25, 2024 17:46
Copy link
Member

@tomlyn tomlyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tomlyn tomlyn merged commit 187b348 into elyra-ai:main Sep 26, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants