colouring-montreal/app/src/frontend/error-box.js
2019-05-27 18:26:29 +01:00

31 lines
776 B
JavaScript

import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
function ErrorBox(props){
if (props.msg) {
console.error(props.msg);
}
return (
<Fragment>
{
(props.msg)?
(
<div className="alert alert-danger" role="alert">
{
(typeof props.msg === 'string' || props.msg instanceof String)?
props.msg
: 'Unexpected error'
}
</div>
) : null
}
</Fragment>
);
}
ErrorBox.propTypes = {
msg: PropTypes.string
}
export default ErrorBox;