| 1 |
import React from "react"; |
| 2 |
import { Button, Alert, Col, Row } from "react-bootstrap"; |
| 3 |
import PropTypes from "prop-types"; |
| 4 |
|
| 5 |
const ErrorAlert = (props) => { |
| 6 |
const { errorAlert, setErrorAlert } = props; |
| 7 |
if (!errorAlert) { |
| 8 |
return <></>; |
| 9 |
} |
| 10 |
return ( |
| 11 |
<Row> |
| 12 |
<Col md={{ span: 10, offset: 1 }} lg={{ span: 8, offset: 2 }}> |
| 13 |
<Alert variant="danger"> |
| 14 |
{errorAlert} |
| 15 |
<Button |
| 16 |
variant="close" |
| 17 |
className="float-end" |
| 18 |
aria-label="Close" |
| 19 |
onClick={() => setErrorAlert(null)} |
| 20 |
></Button> |
| 21 |
</Alert> |
| 22 |
</Col> |
| 23 |
</Row> |
| 24 |
); |
| 25 |
}; |
| 26 |
|
| 27 |
ErrorAlert.propTypes = { |
| 28 |
errorAlert: PropTypes.string, |
| 29 |
setErrorAlert: PropTypes.func, |
| 30 |
}; |
| 31 |
|
| 32 |
export default ErrorAlert; |