From bf7513740c78e210884c2e82c3a6f2c4323c1e00 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 23 Sep 2016 21:42:31 -0300 Subject: [PATCH] Ivan - dev3 deploy implementation fixes --- client/src/app/demo/components-demo-page.js | 4 +- client/src/core-components/tooltip.js | 51 ++++++++++++++++++--- 2 files changed, 47 insertions(+), 8 deletions(-) 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});