mirror of
https://git.netzspielplatz.de/docker-multiarch/openwrt-firmware-selector.git
synced 2025-11-09 01:29:36 +00:00
Add ESLint to maintain code style. Add pre-commit hook to lint prior.
ESLint is used with the standard react plugin. It detects all kinds of issues ranging from misspells, indentation, variable-naming, etc. A pre-commit hook is added to git. Prior commiting, ESlint will run to validate that everything is OK and the user will have the option to fix it. Signed-off-by: Sudhanshu Gautam <me@sudhanshug.com>
This commit is contained in:
parent
d30cf925b1
commit
9475f4092a
13 changed files with 1116 additions and 1036 deletions
68
src/components/error-snackbar.js
Normal file
68
src/components/error-snackbar.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import {
|
||||
IconButton,
|
||||
makeStyles,
|
||||
Snackbar,
|
||||
SnackbarContent,
|
||||
} from '@material-ui/core';
|
||||
import ErrorIcon from '@material-ui/icons/Error';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const SnackBarStyles = makeStyles(theme => ({
|
||||
error: {
|
||||
backgroundColor: theme.palette.error.dark,
|
||||
},
|
||||
message: {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
},
|
||||
icon: {
|
||||
marginRight: '20px',
|
||||
fontSize: 20,
|
||||
},
|
||||
}));
|
||||
|
||||
function ErrorSnackBar({open, closeHandle, errorMessage}) {
|
||||
const classes = SnackBarStyles();
|
||||
return (
|
||||
<Snackbar
|
||||
anchorOrigin={{
|
||||
vertical: 'bottom',
|
||||
horizontal: 'left',
|
||||
}}
|
||||
open={open}
|
||||
autoHideDuration={6000}
|
||||
onClose={closeHandle}
|
||||
ContentProps={{
|
||||
'aria-describedby': 'message-id',
|
||||
}}
|
||||
>
|
||||
<SnackbarContent
|
||||
className={classes.error}
|
||||
aria-describedby="client-snackbar"
|
||||
message={
|
||||
<span id="client-snackbar" className={classes.message}>
|
||||
<ErrorIcon className={classes.icon}/>
|
||||
{errorMessage ||
|
||||
'An unexpected error occurred. Please try again'}
|
||||
</span>
|
||||
}
|
||||
action={[
|
||||
<IconButton key="close" aria-label="Close" color="inherit"
|
||||
onClick={closeHandle}>
|
||||
<CloseIcon/>
|
||||
</IconButton>,
|
||||
]}
|
||||
/>
|
||||
</Snackbar>
|
||||
);
|
||||
}
|
||||
|
||||
ErrorSnackBar.propTypes = {
|
||||
open: PropTypes.boolean,
|
||||
closeHandle: PropTypes.func,
|
||||
errorMessage: PropTypes.string,
|
||||
};
|
||||
|
||||
export default ErrorSnackBar;
|
||||
Loading…
Add table
Add a link
Reference in a new issue