mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-09 11:14:29 +02:00
* 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>
38 lines
1.0 KiB
JavaScript
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;
|