Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#2405 fix tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
siemiatj committed Oct 10, 2019
1 parent e24ab8a commit 836d964
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/components/table/TableFilter.js
Expand Up @@ -17,6 +17,8 @@ class ActionButton extends Component {
docId: PropTypes.string,
tabIndex: PropTypes.number,
children: PropTypes.element,
showTooltip: PropTypes.func,
hideTooltip: PropTypes.func,
};

handleClick = () => {
Expand Down Expand Up @@ -45,14 +47,16 @@ class ActionButton extends Component {
};

render() {
const { action, tabIndex, children } = this.props;
const { action, tabIndex, children, showTooltip, hideTooltip } = this.props;

return (
<button
onClick={this.handleClick}
className="btn btn-meta-outline-secondary btn-distance btn-sm"
tabIndex={tabIndex}
title={action.description}
onMouseEnter={showTooltip}
onMouseLeave={hideTooltip}
>
{action.caption}
{children}
Expand Down Expand Up @@ -152,21 +156,15 @@ class TableFilter extends Component {
return <TableFilterContextShortcuts shortcutActions={shortcutActions} />;
};

showTooltip = () => {
showTooltip = name => {
this.setState({
isTooltipShow: keymap.TOGGLE_QUICK_INPUT,
isTooltipShow: name,
});
};

hideTooltip = (key = null) => {
hideTooltip = () => {
this.setState({
isTooltipShow: key,
});
};

showExpandTooltip = () => {
this.setState({
isTooltipShow: keymap.TOGGLE_EXPAND,
isTooltipShow: null,
});
};

Expand Down Expand Up @@ -207,7 +205,7 @@ class TableFilter extends Component {
<button
className="btn btn-meta-outline-secondary btn-distance btn-sm"
onClick={handleBatchEntryToggle}
onMouseEnter={this.showTooltip}
onMouseEnter={() => this.showTooltip(keymap.TOGGLE_QUICK_INPUT)}
onMouseLeave={this.hideTooltip}
tabIndex={tabIndex}
>
Expand Down Expand Up @@ -241,15 +239,21 @@ class TableFilter extends Component {
docType,
selected,
}}
showTooltip={() => this.showTooltip(action.processId)}
hideTooltip={this.hideTooltip}
key={`top-action-${action.processId}`}
>
<Tooltips
name={
action.shortcut ? action.shortcut.replace('-', '+') : ''
}
action={action.caption}
type={''}
/>
{isTooltipShow === action.processId && (
<Tooltips
name={
action.shortcut
? action.shortcut.replace('-', '+')
: ''
}
action={action.caption}
type={''}
/>
)}
</ActionButton>
))
: null}
Expand All @@ -272,7 +276,7 @@ class TableFilter extends Component {
<button
className="btn-icon btn-meta-outline-secondary pointer"
onClick={toggleFullScreen}
onMouseEnter={this.showExpandTooltip}
onMouseEnter={() => this.showTooltip(keymap.TOGGLE_EXPAND)}
onMouseLeave={this.hideTooltip}
tabIndex="-1"
>
Expand Down

0 comments on commit 836d964

Please sign in to comment.