diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-11-06 14:18:22 +0100 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-11-24 17:22:33 +0100 |
commit | 1fccf4779bbf4d1c125fd65ed3972b57b3c1be6e (patch) | |
tree | 95747a368747f6287e966ebd563f5c814575e4a6 /server/sonar-web/src/main/js/components/ui | |
parent | 51c76205777a9a05783c781bad8c66e3eadef163 (diff) | |
download | sonarqube-1fccf4779bbf4d1c125fd65ed3972b57b3c1be6e.tar.gz sonarqube-1fccf4779bbf4d1c125fd65ed3972b57b3c1be6e.zip |
Rewrite users page to TS and React
Diffstat (limited to 'server/sonar-web/src/main/js/components/ui')
-rw-r--r-- | server/sonar-web/src/main/js/components/ui/buttons.tsx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/components/ui/buttons.tsx b/server/sonar-web/src/main/js/components/ui/buttons.tsx index 0e65602d012..e73bdba9ca5 100644 --- a/server/sonar-web/src/main/js/components/ui/buttons.tsx +++ b/server/sonar-web/src/main/js/components/ui/buttons.tsx @@ -21,14 +21,16 @@ import * as React from 'react'; import * as classNames from 'classnames'; import * as theme from '../../app/theme'; import ClearIcon from '../icons-components/ClearIcon'; -import './buttons.css'; import EditIcon from '../icons-components/EditIcon'; +import Tooltip from '../controls/Tooltip'; +import './buttons.css'; interface ButtonIconProps { children: React.ReactNode; className?: string; color?: string; onClick?: () => void; + tooltip?: string; [x: string]: any; } @@ -43,8 +45,8 @@ export class ButtonIcon extends React.PureComponent<ButtonIconProps> { }; render() { - const { children, className, color = theme.darkBlue, onClick, ...props } = this.props; - return ( + const { children, className, color = theme.darkBlue, onClick, tooltip, ...props } = this.props; + const buttonComponent = ( <button className={classNames(className, 'button-icon')} onClick={this.handleClick} @@ -53,6 +55,14 @@ export class ButtonIcon extends React.PureComponent<ButtonIconProps> { {children} </button> ); + if (tooltip) { + return ( + <Tooltip overlay={tooltip} mouseEnterDelay={0.4}> + {buttonComponent} + </Tooltip> + ); + } + return buttonComponent; } } |