Vulcan/packages/base-components/lib/common/Flash.jsx

26 lines
577 B
React
Raw Normal View History

import React, { PropTypes, Component } from 'react';
2016-03-25 10:45:28 +09:00
import { Alert } from 'react-bootstrap';
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
class Flash extends Component{
2016-02-23 13:10:08 +09:00
componentDidMount() {
Messages.markAsSeen(this.props.message._id);
}
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-02-23 13:10:08 +09:00
module.exports = Flash;