1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-09 11:14:29 +02:00
unleash.unleash/frontend/src/component/error/error-component.jsx
Fredrik Strand Oseberg 10eabb366f Offline mode (#312)
* move all icons to offline mode

* Reorder imports

* revert yarn.lock to original

* resolve errors

* use ConditionalRender, revert material icon css

* add all other font weights

* fix: add library icon

Co-authored-by: Aneesh Relan <aneesh.r@lucideustech.com>
2021-06-29 10:21:54 +02:00

38 lines
1.0 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { Snackbar, IconButton } from '@material-ui/core';
import { Close, QuestionAnswer } from '@material-ui/icons';
const ErrorComponent = ({ errors, muteError }) => {
const showError = errors.length > 0;
const error = showError ? errors[0] : undefined;
return (
<Snackbar
action={
<React.Fragment>
<IconButton size="small" aria-label="close" color="inherit">
<Close />
</IconButton>
</React.Fragment>
}
open={showError}
onClose={() => muteError(error)}
autoHideDuration={10000}
message={
<div key={error}>
<QuestionAnswer />
{error}
</div>
}
/>
);
};
ErrorComponent.propTypes = {
errors: PropTypes.array.isRequired,
muteError: PropTypes.func.isRequired,
};
export default ErrorComponent;