mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 04:26:41 -04:00

them using registerComponent so that they can be overridden by other gui frameworks like material-ui.
28 lines
No EOL
748 B
JavaScript
28 lines
No EOL
748 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import Alert from 'react-bootstrap/lib/Alert'
|
|
import { registerComponent } from 'meteor/vulcan:core';
|
|
|
|
const Flash = ({message, type}) => {
|
|
|
|
type = type === "error" ? "danger" : type; // if type is "error", use "danger" instead
|
|
|
|
return (
|
|
<Alert className="flash-message" bsStyle={type}>
|
|
{Array.isArray(message) ?
|
|
<ul>
|
|
{message.map((message, index) =>
|
|
<li key={index}>{message.content}</li>
|
|
)}
|
|
</ul>
|
|
: <span>{message.content}</span>
|
|
}
|
|
</Alert>
|
|
)
|
|
}
|
|
|
|
Flash.propTypes = {
|
|
message: PropTypes.oneOfType([PropTypes.object.isRequired, PropTypes.array.isRequired])
|
|
}
|
|
|
|
registerComponent('FormFlash', Flash); |