Skip to content

Commit cc9bca7

Browse files
committed
Remove unused event vars and update mouseEnter functions with .bing for es6 syntax
1 parent 83f3c38 commit cc9bca7

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

components/SLDSTooltip/index.jsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,22 @@ class SLDSTooltip extends React.Component {
3939
};
4040
}
4141

42-
componentDidMount(){
43-
},
44-
45-
handleMouseClick(event) {
42+
handleMouseClick() {
4643
this.setState({
4744
isOpen: !this.state.isOpen,
4845
isClosing: !this.state.isOpen
4946
});
50-
},
47+
}
5148

5249

53-
handleMouseEnter(event) {
50+
handleMouseEnter() {
5451
this.setState({
5552
isOpen: true,
5653
isClosing: false
5754
});
58-
},
55+
}
5956

60-
handleMouseLeave(event) {
57+
handleMouseLeave() {
6158
this.setState({isClosing: true});
6259
setTimeout(()=>{
6360
if(this.isMounted && this.state.isClosing){
@@ -67,11 +64,11 @@ class SLDSTooltip extends React.Component {
6764
});
6865
}
6966
},this.props.hoverCloseDelay)
70-
},
67+
}
7168

7269
getTooltipContent() {
7370
return <div className='slds-popover__body'>{this.props.content}</div>;
74-
},
71+
}
7572

7673
getHorizontalAlign() {
7774
if (this.props.align==='left') {
@@ -81,7 +78,7 @@ class SLDSTooltip extends React.Component {
8178
return 'right';
8279
}
8380
return 'center';
84-
},
81+
}
8582

8683
getVerticalAlign() {
8784
if (this.props.align==='bottom') {
@@ -91,14 +88,14 @@ class SLDSTooltip extends React.Component {
9188
return 'top';
9289
}
9390
return 'middle';
94-
},
91+
}
9592

9693
handleCancel() {
9794
this.setState({
9895
isOpen: false,
9996
isClosing: false
10097
});
101-
},
98+
}
10299

103100
getTooltip() {
104101
const style = {
@@ -127,18 +124,18 @@ class SLDSTooltip extends React.Component {
127124
{this.getTooltipContent()}
128125
</div>
129126
</SLDSPopover>:null;
130-
},
127+
}
131128

132129
render(){
133130
return (
134-
<span refs='tooltipTarget' onClick={this.props.openOn === 'click' ? this.handleMouseClick:null} onMouseEnter={this.props.openOn === 'hover' ? this.handleMouseEnter:null} onMouseLeave={this.props.openOn === 'hover' ? this.handleMouseLeave:null}>
131+
<span refs='tooltipTarget' onClick={this.props.openOn === 'click' ? this.handleMouseClick:null} onMouseEnter={this.props.openOn === 'hover' ? this.handleMouseEnter.bind(this):null} onMouseLeave={this.props.openOn === 'hover' ? this.handleMouseLeave.bind(this):null}>
135132
{ this.props.children }
136133
{ this.getTooltip() }
137134
</span>
138135
);
139136
}
140137

141-
};
138+
}
142139

143140

144141
SLDSTooltip.displayName = displayName;

0 commit comments

Comments
 (0)