2021-02-22 01:59:24 -05:00
|
|
|
import React from 'react';
|
2018-09-13 11:58:05 -04:00
|
|
|
|
2019-11-05 15:13:10 -05:00
|
|
|
interface ErrorBoxProps {
|
|
|
|
msg: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ErrorBox: React.FC<ErrorBoxProps> = (props) => {
|
2018-09-30 15:30:04 -04:00
|
|
|
if (props.msg) {
|
|
|
|
console.error(props.msg);
|
|
|
|
}
|
2021-02-22 01:59:24 -05:00
|
|
|
|
|
|
|
return props.msg ?
|
|
|
|
<div className="alert alert-danger" role="alert">
|
2018-09-13 18:55:53 -04:00
|
|
|
{
|
2021-02-22 01:59:24 -05:00
|
|
|
typeof props.msg === 'string' ?
|
|
|
|
props.msg
|
|
|
|
: 'Unexpected error'
|
2018-09-13 18:55:53 -04:00
|
|
|
}
|
2021-02-22 01:59:24 -05:00
|
|
|
</div> :
|
|
|
|
null;
|
2019-11-05 15:13:10 -05:00
|
|
|
};
|
2019-05-27 13:26:29 -04:00
|
|
|
|
2018-09-13 11:58:05 -04:00
|
|
|
export default ErrorBox;
|