1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-25 18:56:28 +02:00
onion/js/components/ascribe_forms/alert.js
ddejongh 509aa111ab Merge remote-tracking branch 'remotes/origin/master' into AD-43-in-piece_detail-add-generic-field-
Conflicts:
	gulpfile.js

added notifications
cleaned up proptypes
2015-06-09 16:10:38 +02:00

40 lines
754 B
JavaScript

'use strict';
import React from 'react';
import Alert from 'react-bootstrap/lib/Alert';
let AlertDismissable = React.createClass({
propTypes: {
error: React.PropTypes.array.isRequired
},
getInitialState() {
return {
alertVisible: true
};
},
show() {
this.setState({alertVisible: true});
},
hide() {
this.setState({alertVisible: false});
},
render() {
if (this.state.alertVisible) {
return (
<Alert bsStyle='danger' onDismiss={this.hide}>
{this.props.error}
</Alert>
);
}
return (
<span />
);
}
});
export default AlertDismissable;