Skip to content

Commit

Permalink
Add more node properties
Browse files Browse the repository at this point in the history
  • Loading branch information
rvazarkar committed Sep 28, 2017
1 parent c29d3c1 commit 66e86f8
Show file tree
Hide file tree
Showing 5 changed files with 323 additions and 300 deletions.
74 changes: 37 additions & 37 deletions src/components/Float/Alert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@ import React, { Component } from 'react';
import { Alert } from 'react-bootstrap';

export default class GenericAlert extends Component {
constructor(){
super()
this.state = {
visible: false,
text: "No data returned from query",
timeout: null
}
constructor(){
super();
this.state = {
visible: false,
text: "No data returned from query",
timeout: null
};

emitter.on('showAlert', this._show.bind(this))
emitter.on('hideAlert', this._dismiss.bind(this))
}
emitter.on('showAlert', this._show.bind(this));
emitter.on('hideAlert', this._dismiss.bind(this));
}

_dismiss(){
this.setState({visible: false});
}
_dismiss(){
this.setState({visible: false});
}

_show(val){
clearTimeout(this.state.timeout)
var t = setTimeout(function(){
this._dismiss()
}.bind(this), 2500)

this.setState({
visible: true,
text: val,
timeout: t
})
_show(val){
clearTimeout(this.state.timeout);
var t = setTimeout(function(){
this._dismiss();
}.bind(this), 2500);

}
this.setState({
visible: true,
text: val,
timeout: t
});

}

render() {
if (this.state.visible){
return (
<Alert className="alertdiv" bsStyle="danger" onDismiss={this._dismiss.bind(this)}>
{this.state.text}
</Alert>
)
}else{
return null
}
}
render() {
if (this.state.visible){
return (
<Alert className="alertdiv" bsStyle="danger" onDismiss={this._dismiss.bind(this)}>
{this.state.text}
</Alert>
);
}else{
return null;
}
}
}
Loading

0 comments on commit 66e86f8

Please sign in to comment.