Created
December 6, 2016 01:05
-
-
Save SwartzCr/bde0a9267147e67fe31d2bd96d54304f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Word = React.createClass({ | |
callback: function(e) { | |
e.preventDefault(); | |
this.props.formCB(this.props.id, this.state.value); | |
}, | |
getInitialState: function() { | |
return {value: ""}; | |
}, | |
handleChange: function(e) { | |
this.setState({value: e.target.value}); | |
}, | |
render: function() { | |
let style; | |
let tooltip; | |
let pointer = {pointerEvents: "auto"}; | |
if(this.props.id === this.props.hilight.toString()){ | |
style = {color: "magenta"}; | |
if(this.props.tooltip){ | |
tooltip = <ReactTooltip class="whatever" id={this.props.id} place="top" effect="solid"> <form onSubmit={this.callback}><input id="text_box" type="text" value={this.state.value} onChange={this.handleChange} /></form> </ReactTooltip>; | |
ReactTooltip.show(this.refs.foo); | |
} | |
} else { | |
style = {color: "black"}; | |
} | |
let inline = {display: "inline"}; | |
return ( | |
<div style={inline}> | |
<a style={style} id={this.props.id} ref='foo' data-tip data-event="custom" data-for={this.props.id}> | |
{this.props.text} { " " } | |
</a> | |
{tooltip} | |
</div> | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment