2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
import React from 'react';
|
|
|
|
import Alert from 'react-bootstrap/lib/Alert';
|
|
|
|
|
|
|
|
let AlertDismissable = React.createClass({
|
2015-06-09 16:10:38 +02:00
|
|
|
propTypes: {
|
|
|
|
error: React.PropTypes.array.isRequired
|
|
|
|
},
|
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
getInitialState() {
|
|
|
|
return {
|
|
|
|
alertVisible: true
|
|
|
|
};
|
|
|
|
},
|
2015-06-05 11:06:36 +02:00
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
show() {
|
|
|
|
this.setState({alertVisible: true});
|
|
|
|
},
|
2015-06-05 11:06:36 +02:00
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
hide() {
|
|
|
|
this.setState({alertVisible: false});
|
|
|
|
},
|
2015-06-05 11:06:36 +02:00
|
|
|
|
2015-05-29 01:54:56 +02:00
|
|
|
render() {
|
|
|
|
if (this.state.alertVisible) {
|
|
|
|
return (
|
|
|
|
<Alert bsStyle='danger' onDismiss={this.hide}>
|
|
|
|
{this.props.error}
|
|
|
|
</Alert>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<span />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-06-01 14:22:04 +02:00
|
|
|
export default AlertDismissable;
|