Skip to content

Instantly share code, notes, and snippets.

@SwartzCr
Created December 6, 2016 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SwartzCr/bde0a9267147e67fe31d2bd96d54304f to your computer and use it in GitHub Desktop.
Save SwartzCr/bde0a9267147e67fe31d2bd96d54304f to your computer and use it in GitHub Desktop.
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