diff --git a/client/src/app/demo/components-demo-page.js b/client/src/app/demo/components-demo-page.js
index 363d4873..592821ef 100644
--- a/client/src/app/demo/components-demo-page.js
+++ b/client/src/app/demo/components-demo-page.js
@@ -87,7 +87,9 @@ let DemoPage = React.createClass({
title: 'Tooltip',
render: (
- hola
+
+ hola
+
)
},
diff --git a/client/src/core-components/tooltip.js b/client/src/core-components/tooltip.js
index f400abca..d293c7c4 100644
--- a/client/src/core-components/tooltip.js
+++ b/client/src/core-components/tooltip.js
@@ -5,19 +5,21 @@ class Tooltip extends React.Component {
static propTypes = {
children: React.PropTypes.node,
- content: React.PropTypes.node
+ content: React.PropTypes.node,
+ openOnHover: React.PropTypes.bool
};
- constructor (props){
- super(props);
- this.state = {show : false};
- }
+ state = {
+ show : false
+ };
render (){
return (
-
+
{(this.state.show) ? this.renderAnimatedMessage() : null}
-
{this.props.children}
+
+ {this.props.children}
+
);
}
@@ -40,6 +42,41 @@ class Tooltip extends React.Component {
)
}
+
+ getProps(){
+ let props = {};
+
+ props.className = 'tooltip';
+
+ if(this.props.openOnHover) {
+ props.onMouseOver = this.onMouseOver.bind(this);
+ props.onMouseOut = this.onMouseOut.bind(this);
+ }
+
+ return props;
+ }
+
+ getChildrenProps() {
+ let props = {};
+ props.className= 'tooltip__children';
+
+ if (this.props.openOnHover) {
+ props.onClick= this.onClick.bind(this);
+ }
+ return props;
+ }
+
+ onMouseOver() {
+ this.setState({
+ show:true
+ })
+ }
+ onMouseOut() {
+ this.setState({
+ show:false
+ })
+ }
+
onClick(){
if (this.state.show) {
this.setState({show : false});