Skip to content

Commit f5db9e5

Browse files
committed
Use classNames module in tooltip for cmp consistency
1 parent 0c43167 commit f5db9e5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

components/SLDSTooltip/index.jsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1010

1111
import React from 'react';
1212
import SLDSPopover from '../SLDSPopover';
13-
import cx from 'classnames';
13+
const classNames = require("classnames");
1414

1515
const displayName = "SLDSTooltip";
1616
const propTypes = {
@@ -106,16 +106,17 @@ class SLDSTooltip extends React.Component {
106106
});
107107
}
108108

109-
getTooltip() {
110-
const style = {
111-
'slds-popover': true,
112-
'slds-popover--tooltip': true,
113-
'slds-nubbin--top': this.props.align === 'bottom',
114-
'slds-nubbin--bottom': this.props.align === 'top',
115-
'slds-nubbin--left': this.props.align === 'right',
116-
'slds-nubbin--right': this.props.align === 'left'
117-
};
109+
getClassName() {
110+
return classNames(this.props.className, "slds-popover", {
111+
["slds-popover--tooltip"]: true,
112+
["slds-nubbin--top"]: this.props.align === 'bottom',
113+
['slds-nubbin--bottom']: this.props.align === 'top',
114+
['slds-nubbin--left']: this.props.align === 'right',
115+
['slds-nubbin--right']: this.props.align === 'left'
116+
});
117+
}
118118

119+
getTooltip() {
119120
return this.state.isOpen?<SLDSPopover
120121
key={this.getHorizontalAlign()+' '+this.getVerticalAlign()}
121122
targetElement={this.refs.tooltipTarget}
@@ -129,7 +130,7 @@ class SLDSTooltip extends React.Component {
129130
verticalAlign={this.getVerticalAlign()}
130131
flippable={false}
131132
onClose={this.handleCancel.bind(this)}>
132-
<div className={cx(style)} role="tooltip">
133+
<div className={this.getClassName()} role="tooltip">
133134
{this.getTooltipContent()}
134135
</div>
135136
</SLDSPopover>:null;

0 commit comments

Comments
 (0)