2016-08-10 21:36:11 +02:00
|
|
|
// NPM imports
|
2016-08-06 16:46:54 +02:00
|
|
|
import React, { Component, PropTypes } from "react";
|
|
|
|
|
2016-08-10 21:36:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A dismissible Bootstrap alert.
|
|
|
|
*/
|
2016-08-06 16:46:54 +02:00
|
|
|
export default class DismissibleAlert extends Component {
|
2016-08-10 23:50:23 +02:00
|
|
|
render() {
|
2016-08-10 21:36:11 +02:00
|
|
|
// Set correct alert type
|
2016-08-06 16:46:54 +02:00
|
|
|
let alertType = "alert-danger";
|
|
|
|
if (this.props.type) {
|
|
|
|
alertType = "alert-" + this.props.type;
|
|
|
|
}
|
2016-08-10 21:36:11 +02:00
|
|
|
|
2016-08-06 16:46:54 +02:00
|
|
|
return (
|
|
|
|
<div className={["alert", alertType].join(" ")} role="alert">
|
|
|
|
<p>
|
|
|
|
<button type="button" className="close" data-dismiss="alert" aria-label="Close">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
{this.props.text}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DismissibleAlert.propTypes = {
|
|
|
|
type: PropTypes.string,
|
2016-08-10 23:50:23 +02:00
|
|
|
text: PropTypes.string,
|
2016-08-06 16:46:54 +02:00
|
|
|
};
|