Unverified Commit 8d2a2eb7 authored by Florent Chehab's avatar Florent Chehab
Browse files

fix(eslint): cleaned code after eslint update

parent e692470f
......@@ -11,7 +11,7 @@ import {
infoMenuItems,
mainMenuItems,
secondaryMenuItems,
settingsMenuItems
settingsMenuItems,
} from "./menuItems";
import IconWithMenu from "../common/IconWithMenu";
import DrawerMenu from "./DrawerMenu";
......@@ -22,94 +22,94 @@ import Logo from "./Logo";
import BaseTemplate from "./BaseTemplate";
import useOpenClose from "../../hooks/useOpenClose";
const useStyles = makeStyles(theme => {
const useStyles = makeStyles((theme) => {
const onDesktops = "@media (min-width:1375px)";
const onMobiles = "@media (max-width:1375px)";
return {
menuButton: {
[onDesktops]: {
display: "none"
display: "none",
},
marginLeft: -12,
marginRight: 20
marginRight: 20,
},
menuButtonIcon: {
fontSize: "1.5em"
fontSize: "1.5em",
},
mainMenuButton: {
fontSize: "1.2rem",
fontWeight: 700,
[onMobiles]: {
display: "none"
display: "none",
},
[onDesktops]: {
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1)
}
marginRight: theme.spacing(1),
},
},
mainMenuButtonIcon: {
marginLeft: theme.spacing(1),
fontSize: "1.2em",
[onMobiles]: {
display: "none"
}
display: "none",
},
},
contrastTextPrimary: {
color: theme.palette.getContrastText(theme.palette.primary.main)
color: theme.palette.getContrastText(theme.palette.primary.main),
},
contrastTextSecondary: {
color: theme.palette.getContrastText(theme.palette.secondary.main)
color: theme.palette.getContrastText(theme.palette.secondary.main),
},
mobileIcon: {
color: theme.palette.getContrastText(theme.palette.primary.main)
color: theme.palette.getContrastText(theme.palette.primary.main),
},
mobileIconContainer: {
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1)
marginRight: theme.spacing(1),
},
primaryDark: {
backgroundColor: theme.palette.primary.dark,
boxShadow: theme.shadows[1]
boxShadow: theme.shadows[1],
},
desktopOnly: {
[onMobiles]: {
display: "none"
}
display: "none",
},
},
mobileOnly: {
[onDesktops]: {
display: "none"
}
display: "none",
},
},
ifNotTooSmallAndInlined: {
"@media (max-width:790px)": {
display: "none"
display: "none",
},
display: "inline"
display: "inline",
},
centered: {
margin: "0 auto"
margin: "0 auto",
},
leftBlock: {
flex: 2
flex: 2,
},
middleBlock: {
flex: 1
flex: 1,
},
rightBlock: {
flex: 2,
display: "flex",
alignItems: "center",
justifyContent: "space-between",
textAlign: "center"
textAlign: "center",
},
widthFitContent: {
width: "fit-content"
width: "fit-content",
},
filler: {
width: "100%"
}
width: "100%",
},
};
});
......@@ -123,7 +123,7 @@ function SecondaryIcons() {
fabProps={{
color: "primary",
className: classes.mobileIconContainer,
classes: { primary: classes.primaryDark }
classes: { primary: classes.primaryDark },
}}
menuItems={infoMenuItems}
/>
......@@ -134,7 +134,7 @@ function SecondaryIcons() {
fabProps={{
color: "primary",
className: classes.mobileIconContainer,
classes: { primary: classes.primaryDark }
classes: { primary: classes.primaryDark },
}}
menuItems={settingsMenuItems}
/>
......@@ -179,7 +179,7 @@ function MenuItems({ items }) {
}
MenuItems.propTypes = {
items: PropTypes.array.isRequired
items: PropTypes.array.isRequired,
};
/**
......@@ -200,14 +200,12 @@ function SimplifiedItems({ items }) {
aria-label={label}
className={classes.mobileIconContainer}
>
{
<Icon
className={classNames(
classes.mobileIcon,
classes.contrastTextSecondary
)}
/>
}
<Icon
className={classNames(
classes.mobileIcon,
classes.contrastTextSecondary
)}
/>
</Fab>
</CustomNavLink>
))}
......@@ -216,7 +214,7 @@ function SimplifiedItems({ items }) {
}
SimplifiedItems.propTypes = {
items: PropTypes.array.isRequired
items: PropTypes.array.isRequired,
};
function SimplifiedLeft({ openDrawer }) {
......@@ -237,7 +235,7 @@ function SimplifiedLeft({ openDrawer }) {
}
SimplifiedLeft.propTypes = {
openDrawer: PropTypes.func.isRequired
openDrawer: PropTypes.func.isRequired,
};
function SimplifiedRight() {
......@@ -273,7 +271,7 @@ function MainAppFrame({ children }) {
<div
style={{
flex: 3,
flexBasis: "auto"
flexBasis: "auto",
}}
>
<MenuItems items={secondaryMenuItems} />
......@@ -282,7 +280,7 @@ function MainAppFrame({ children }) {
<div
style={{
flex: 4,
flexBasis: "auto"
flexBasis: "auto",
}}
>
<SecondaryIcons />
......@@ -299,7 +297,7 @@ function MainAppFrame({ children }) {
}
MainAppFrame.propTypes = {
children: PropTypes.node.isRequired
children: PropTypes.node.isRequired,
};
export default MainAppFrame;
......@@ -12,9 +12,9 @@ const useStyles = makeStyles({
multilineButton: {
display: "block",
marginLeft: "auto",
marginRight: "auto"
marginRight: "auto",
},
button: {}
button: {},
});
/**
......@@ -30,7 +30,7 @@ function Alert({
infoText,
multilineButtons,
disagreeText,
agreeText
agreeText,
}) {
const classes = useStyles();
......@@ -40,58 +40,56 @@ function Alert({
return (
<Dialog open>
{
<>
<DialogTitle>{title}</DialogTitle>
<DialogContent>
<DialogContentText style={{ whiteSpace: "pre-wrap" }}>
{description}
</DialogContentText>
</DialogContent>
<DialogActions>
{info ? (
<>
<DialogTitle>{title}</DialogTitle>
<DialogContent>
<DialogContentText style={{ whiteSpace: "pre-wrap" }}>
{description}
</DialogContentText>
</DialogContent>
<DialogActions>
{info ? (
<Button
onClick={() => {
handleClose();
handleResponse();
}}
color="primary"
>
{infoText}
</Button>
) : (
<div>
<Button
onClick={() => {
handleClose();
handleResponse();
handleResponse(false);
}}
color="secondary"
className={
multilineButtons ? classes.multilineButton : classes.button
}
>
{disagreeText}
</Button>
<Button
onClick={() => {
handleClose();
handleResponse(true);
}}
className={
multilineButtons ? classes.multilineButton : classes.button
}
variant="outlined"
color="primary"
autoFocus
>
{infoText}
{agreeText}
</Button>
) : (
<div>
<Button
onClick={() => {
handleClose();
handleResponse(false);
}}
color="secondary"
className={
multilineButtons ? classes.multilineButton : classes.button
}
>
{disagreeText}
</Button>
<Button
onClick={() => {
handleClose();
handleResponse(true);
}}
className={
multilineButtons ? classes.multilineButton : classes.button
}
variant="outlined"
color="primary"
autoFocus
>
{agreeText}
</Button>
</div>
)}
</DialogActions>
</>
}
</div>
)}
</DialogActions>
</>
</Dialog>
);
}
......@@ -106,7 +104,7 @@ Alert.propTypes = {
disagreeText: PropTypes.string, // Text display in the "disagree" button
multilineButtons: PropTypes.bool, // should the agree/disagree button displayed on multiple lines
handleClose: PropTypes.func, // function called when the alert is closed
handleResponse: PropTypes.func // function called allong the previous one with false if the user disagreed and true otherwise. Or no parameters if info.
handleResponse: PropTypes.func, // function called allong the previous one with false if the user disagreed and true otherwise. Or no parameters if info.
};
Alert.defaultProps = {
......@@ -125,7 +123,7 @@ Alert.defaultProps = {
handleResponse: () => {
// eslint-disable-next-line no-console
console.error("Missing function for handling post performClose.");
}
},
};
export default Alert;
......@@ -18,7 +18,7 @@ const ForwardedNavLink = React.forwardRef((props, ref) => (
function IconWithMenu({ fabProps, Icon, menuItems, iconProps }) {
const [anchorEl, setAnchorEl] = useState(null);
const handleOpenMenu = useCallback(event => {
const handleOpenMenu = useCallback((event) => {
setAnchorEl(event.currentTarget);
}, []);
......@@ -30,17 +30,17 @@ function IconWithMenu({ fabProps, Icon, menuItems, iconProps }) {
return (
<>
<Fab size="medium" color="inherit" onClick={handleOpenMenu} {...fabProps}>
{<Icon {...iconProps} />}
<Icon {...iconProps} />
</Fab>
<Menu
anchorEl={anchorEl}
anchorOrigin={{
vertical: "top",
horizontal: "right"
horizontal: "right",
}}
transformOrigin={{
vertical: "top",
horizontal: "right"
horizontal: "right",
}}
open={open}
onClose={handleCloseMenu}
......@@ -75,14 +75,14 @@ function IconWithMenu({ fabProps, Icon, menuItems, iconProps }) {
IconWithMenu.defaultProps = {
fabProps: {},
iconProps: {}
iconProps: {},
};
IconWithMenu.propTypes = {
Icon: PropTypes.object.isRequired, // should be a react component
menuItems: PropTypes.array.isRequired, // should be an array of menu items
fabProps: PropTypes.object,
iconProps: PropTypes.object
iconProps: PropTypes.object,
};
export default React.memo(IconWithMenu);
import { ThemeProvider as MuiThemeProvider } from "@material-ui/core/styles";
import PropTypes from "prop-types";
import React from "react";
import defaultTheme from "../../../config/defaultTheme";
import defaultTheme from "../../../config/defaultTheme.json";
import { getTheme, updatePhoneStatusBarColor } from "./utils";
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment