2016-03-17 18:08:03 +09:00
|
|
|
import React, { PropTypes, Component } from 'react';
|
2016-03-25 10:45:28 +09:00
|
|
|
import { Alert } from 'react-bootstrap';
|
2016-03-17 18:08:03 +09:00
|
|
|
|
2016-02-25 17:44:43 +09:00
|
|
|
import Core from "meteor/nova:core";
|
|
|
|
const Messages = Core.Messages;
|
2016-02-23 13:10:08 +09:00
|
|
|
|
2016-03-17 18:08:03 +09:00
|
|
|
class Flash extends Component{
|
2016-02-23 13:10:08 +09:00
|
|
|
|
|
|
|
componentDidMount() {
|
2016-02-24 18:11:53 +09:00
|
|
|
Messages.markAsSeen(this.props.message._id);
|
2016-03-17 18:08:03 +09:00
|
|
|
}
|
2016-02-23 13:10:08 +09:00
|
|
|
|
|
|
|
render() {
|
2016-03-25 10:45:28 +09:00
|
|
|
|
|
|
|
let type = this.props.message.type;
|
|
|
|
type = type === "error" ? "danger" : type; // if type is "error", use "danger" instead
|
|
|
|
|
2016-02-23 13:10:08 +09:00
|
|
|
return (
|
2016-03-25 10:45:28 +09:00
|
|
|
<Alert className="flash-message" bsStyle={type}>
|
|
|
|
{this.props.message.content}
|
|
|
|
</Alert>
|
2016-02-23 13:10:08 +09:00
|
|
|
)
|
|
|
|
}
|
2016-03-17 18:08:03 +09:00
|
|
|
}
|
2016-02-23 13:10:08 +09:00
|
|
|
|
|
|
|
module.exports = Flash;
|