react-saas/src/components/Error.jsx

31 lines
No EOL
687 B
JavaScript

import {Box,Alert,AlertTitle} from "@mui/material";
import {useTranslate} from "react-polyglot";
import PropTypes from "prop-types";
const Error = ({titulo,texto,align = "center",severity = "error"}) => {
const translate = useTranslate();
return (
<Box sx={{
display: "flex",
flexDirection: "column",
flexGrow: 1,
justifyContent: "center",
alignItems: align
}}>
<Alert severity={severity}>
<AlertTitle>{translate(titulo)}</AlertTitle>
{texto && translate(texto)}
</Alert>
</Box>
);
};
Error.propTypes={
titulo: PropTypes.string.isRequired,
texto: PropTypes.string,
align: PropTypes.string,
severity: PropTypes.string
};
export default Error;