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

Issue #364 - dangling tooltips #383

Merged
merged 10 commits into from
Dec 3, 2018
1 change: 1 addition & 0 deletions src/components/FullDetailView/FullDetailComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class FullDetailComponent extends Component {
<span>Files</span>
&nbsp;
<ButtonWithTooltip
disabled={entry === undefined}
button={
<Button bsStyle="danger" onClick={() => handleRevert('files')} disabled={entry === undefined}>
<i className="fas fa-undo" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Navigation/Ui/ButtonWithTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import React from 'react'
import { Tooltip } from 'antd'

const ButtonWithTooltip = ({ button, tip }) => {
const ButtonWithTooltip = ({ button, tip, disabled }) => {
return (
<Tooltip placement="topLeft" title={tip} arrowPointAtCenter>
<Tooltip placement="topLeft" title={!disabled && tip} arrowPointAtCenter>
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a nice workaround for the issue!

Can we read the disabled property of button or do we need a separate prop for this?

Copy link
Member

Choose a reason for hiding this comment

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

don't think that we can use the disabled prop of the supplied button. In the general case the value fo the button prop may not be an instance of the Button component so may not have a disabled prop. For example, it might be a Button wrapped in some other component (e.g., a Dropzone). So button would be an instance of Dropzone.

{button}
</Tooltip>
)
Expand Down
1 change: 1 addition & 0 deletions src/components/Navigation/Ui/ComponentButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default class ComponentButtons extends Component {
!isDefinitionEmpty && (
<ButtonWithTooltip
tip={'Revert Changes of this Definition'}
disabled={!hasChange(component)}
button={
<Button
className="list-fa-button"
Expand Down