styles changes

master
Tudor Stanciu 2021-04-16 01:53:20 +03:00
parent 1d71710888
commit 54a75c104d
7 changed files with 178 additions and 103 deletions

View File

@ -11,23 +11,6 @@ const useStyles = makeStyles(() => ({
minHeight: "100vh", minHeight: "100vh",
display: "flex", display: "flex",
flexDirection: "column" flexDirection: "column"
},
content: {
minHeight: "80vh",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
fontSize: "calc(10px + 2vmin)",
color: "white"
},
appLoginOnly: {
backgroundColor: "#282c34",
minHeight: "100vh",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center"
} }
})); }));
@ -37,13 +20,11 @@ const Main = () => {
const tokenIsValid = validateToken(); const tokenIsValid = validateToken();
return ( return (
<div className={tokenIsValid ? classes.app : classes.appLoginOnly}> <div className={classes.app}>
{tokenIsValid ? ( {tokenIsValid ? (
<> <>
<ApplicationStepper /> <ApplicationStepper />
<div className={classes.content}> <Switcher />
<Switcher />
</div>
</> </>
) : ( ) : (
<LoginContainer /> <LoginContainer />

View File

@ -17,21 +17,9 @@ import { AccountBox, RotateLeft, ExitToApp } from "@material-ui/icons";
import LoginComponent from "./LoginComponent"; import LoginComponent from "./LoginComponent";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useToast } from "../../../hooks"; import { useToast } from "../../../hooks";
import styles from "../styles";
const useStyles = makeStyles(theme => ({ const useStyles = makeStyles(styles);
card: {
minWidth: 350
},
onRight: {
marginLeft: "auto"
},
avatar: {
backgroundColor: theme.palette.primary.main
},
collapseContent: {
padding: 0
}
}));
const LoggedInComponent = ({ const LoggedInComponent = ({
credentials, credentials,
@ -69,59 +57,61 @@ const LoggedInComponent = ({
}; };
return ( return (
<Card className={classes.card}> <div className={classes.loggedInContent}>
<CardHeader <Card className={classes.loggedInCard}>
avatar={ <CardHeader
<Avatar aria-label="user" className={classes.avatar}> avatar={
<AccountBox /> <Avatar aria-label="user" className={classes.avatar}>
</Avatar> <AccountBox />
} </Avatar>
title={ }
<strong> title={
{t("Login.Hello", { username: credentials.userName })} <strong>
</strong> {t("Login.Hello", { username: credentials.userName })}
} </strong>
subheader={ }
<Tooltip title={t("Login.AuthenticationDate")}> subheader={
<Typography variant="caption" display="block"> <Tooltip title={t("Login.AuthenticationDate")}>
{getTokenValidFrom()} <Typography variant="caption" display="block">
</Typography> {getTokenValidFrom()}
</Tooltip> </Typography>
} </Tooltip>
/> }
/>
<CardActions disableSpacing> <CardActions disableSpacing>
<Tooltip title={t("Login.ChangeUser")}> <Tooltip title={t("Login.ChangeUser")}>
<IconButton <IconButton
size="small" size="small"
className={classes.onRight} className={classes.onRight}
onClick={handleExpandLogin} onClick={handleExpandLogin}
aria-expanded={expanded} aria-expanded={expanded}
aria-label="show login component" aria-label="show login component"
>
<RotateLeft />
</IconButton>
</Tooltip>
<Tooltip title={t("Login.Logout")}>
<IconButton size="small" onClick={onLogout}>
<ExitToApp />
</IconButton>
</Tooltip>
</CardActions>
<Divider />
<Collapse in={expanded} timeout="auto" unmountOnExit>
<CardContent
className={classes.collapseContent}
style={{ paddingBottom: "5px" }}
> >
<RotateLeft /> <LoginComponent
</IconButton> credentials={credentials}
</Tooltip> onChange={onChange}
<Tooltip title={t("Login.Logout")}> onLogin={handleLogin}
<IconButton size="small" onClick={onLogout}> />
<ExitToApp /> </CardContent>
</IconButton> </Collapse>
</Tooltip> </Card>
</CardActions> </div>
<Divider />
<Collapse in={expanded} timeout="auto" unmountOnExit>
<CardContent
className={classes.collapseContent}
style={{ paddingBottom: "5px" }}
>
<LoginComponent
credentials={credentials}
onChange={onChange}
onLogin={handleLogin}
/>
</CardContent>
</Collapse>
</Card>
); );
}; };

View File

@ -1,18 +1,25 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Card } from "@material-ui/core"; import { Card } from "@material-ui/core";
import { makeStyles } from "@material-ui/core/styles";
import styles from "../styles";
import LoginComponent from "./LoginComponent"; import LoginComponent from "./LoginComponent";
const useStyles = makeStyles(styles);
const LoginCard = ({ credentials, onChange, onLogin }) => { const LoginCard = ({ credentials, onChange, onLogin }) => {
const classes = useStyles();
return ( return (
<Card variant="outlined"> <div className={classes.appLogin}>
<LoginComponent <Card variant="outlined">
credentials={credentials} <LoginComponent
onChange={onChange} credentials={credentials}
onLogin={onLogin} onChange={onChange}
/> onLogin={onLogin}
</Card> />
</Card>
</div>
); );
}; };

View File

@ -11,16 +11,9 @@ import {
import { AccountCircleOutlined } from "@material-ui/icons"; import { AccountCircleOutlined } from "@material-ui/icons";
import PasswordField from "../../../components/common/inputs/PasswordField"; import PasswordField from "../../../components/common/inputs/PasswordField";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styles from "../styles";
const useStyles = makeStyles(theme => ({ const useStyles = makeStyles(styles);
field: {
margin: theme.spacing(1),
width: "300px"
},
onRight: {
marginLeft: "auto"
}
}));
const LoginComponent = ({ credentials, onChange, onLogin }) => { const LoginComponent = ({ credentials, onChange, onLogin }) => {
const classes = useStyles(); const classes = useStyles();

View File

@ -0,0 +1,33 @@
const styles = theme => ({
loggedInCard: {
minWidth: 350
},
onRight: {
marginLeft: "auto"
},
avatar: {
backgroundColor: theme.palette.primary.main
},
collapseContent: {
padding: 0
},
loggedInContent: {
minHeight: "80vh",
display: "flex",
alignItems: "center",
justifyContent: "center",
fontSize: "calc(10px + 2vmin)"
},
appLogin: {
minHeight: "100vh",
display: "flex",
justifyContent: "center",
alignItems: "center"
},
field: {
margin: theme.spacing(1),
width: "300px"
}
});
export default styles;

View File

@ -0,0 +1,69 @@
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import Accordion from "@material-ui/core/Accordion";
import AccordionSummary from "@material-ui/core/AccordionSummary";
import AccordionDetails from "@material-ui/core/AccordionDetails";
import Typography from "@material-ui/core/Typography";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
const useStyles = makeStyles(theme => ({
root: {
width: "100%"
},
heading: {
fontSize: theme.typography.pxToRem(15),
fontWeight: theme.typography.fontWeightRegular
}
}));
const MachinesList = () => {
const classes = useStyles();
return (
<div className={classes.root}>
<Accordion>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel1a-content"
id="panel1a-header"
>
<Typography className={classes.heading}>Accordion 1</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget.
</Typography>
</AccordionDetails>
</Accordion>
<Accordion>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel2a-content"
id="panel2a-header"
>
<Typography className={classes.heading}>Accordion 2</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget.
</Typography>
</AccordionDetails>
</Accordion>
<Accordion disabled>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel3a-content"
id="panel3a-header"
>
<Typography className={classes.heading}>
Disabled Accordion
</Typography>
</AccordionSummary>
</Accordion>
</div>
);
};
export default MachinesList;

View File

@ -5,6 +5,7 @@ import {
ApplicationDispatchContext ApplicationDispatchContext
} from "../../../state/ApplicationContexts"; } from "../../../state/ApplicationContexts";
import { readMachines } from "../api"; import { readMachines } from "../api";
import MachinesList from "./MachinesList";
const NetworkContainer = () => { const NetworkContainer = () => {
const state = useContext(ApplicationStateContext); const state = useContext(ApplicationStateContext);
@ -22,6 +23,7 @@ const NetworkContainer = () => {
return ( return (
<> <>
<div>NetworkContainer</div> <div>NetworkContainer</div>
<MachinesList />
<TextField <TextField
id="ertet" id="ertet"
label="Test" label="Test"