mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 09:50:31 +01:00
31 lines
698 B
JavaScript
31 lines
698 B
JavaScript
|
import React from 'react';
|
||
|
import Alert from 'react-bootstrap/lib/Alert';
|
||
|
|
||
|
let AlertDismissable = React.createClass({
|
||
|
getInitialState() {
|
||
|
return {
|
||
|
alertVisible: true
|
||
|
};
|
||
|
},
|
||
|
show() {
|
||
|
this.setState({alertVisible: true});
|
||
|
},
|
||
|
hide() {
|
||
|
this.setState({alertVisible: false});
|
||
|
},
|
||
|
render() {
|
||
|
if (this.state.alertVisible) {
|
||
|
let key = this.props.error;
|
||
|
return (
|
||
|
<Alert bsStyle='danger' onDismiss={this.hide}>
|
||
|
{this.props.error}
|
||
|
</Alert>
|
||
|
);
|
||
|
}
|
||
|
return (
|
||
|
<span />
|
||
|
);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
export default AlertDismissable;
|