minor fixes / add grid to login page

This commit is contained in:
Raghunandan Balachandran
2020-02-04 13:17:01 +01:00
parent 4184ff0908
commit ba83266bf5
2 changed files with 47 additions and 31 deletions
+23 -24
View File
@@ -9,8 +9,8 @@ import {
BrowserRouter as Router,
Switch,
Route,
Link as RouterLink
} from "react-router-dom";
Link as RouterLink,
} from 'react-router-dom';
const useStyles = makeStyles(theme => ({
root: {
@@ -26,7 +26,7 @@ const useStyles = makeStyles(theme => ({
overflowY: 'auto',
},
pageBody: {
paddingLeft: theme.spacing(2),
paddingLeftß: theme.spacing(2),
paddingTop: theme.spacing(2),
},
avatarButton: {
@@ -36,20 +36,21 @@ const useStyles = makeStyles(theme => ({
const App: FC<{}> = () => {
return (
<Router>
<Switch>
<Route exact path="/">
<AppShell>
<Home />
</AppShell>
</Route>
<Route path="/login">
<AppShell>
<Login />
</AppShell>
</Route>
</Switch>
</Router>);
<Router>
<Switch>
<Route exact path="/">
<AppShell>
<Home />
</AppShell>
</Route>
<Route path="/login">
<AppShell>
<Login />
</AppShell>
</Route>
</Switch>
</Router>
);
};
const Home: FC<{}> = () => {
@@ -75,10 +76,10 @@ const Login: FC<{}> = () => {
<RouterLink to="/">Go to Home</RouterLink>
</div>
</Fragment>
);
}
);
};
const AppShell: FC<{}> = ({children}) => {
const AppShell: FC<{}> = ({ children }) => {
const classes = useStyles();
return (
@@ -86,12 +87,10 @@ const AppShell: FC<{}> = ({children}) => {
<SideBar />
<div className={classes.mainContentArea}>
<PageHeader />
<div className={classes.pageBody}>
{children}
</div>
<div className={classes.pageBody}>{children}</div>
</div>
</div>
);
}
};
export default App;
@@ -1,18 +1,35 @@
import React, { FC, Fragment } from 'react';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import Grid from '@material-ui/core/Grid';
const LoginComponent: FC<{}> = () => {
return (
<Fragment>
<TextField variant="outlined" label="Username: " />
<Button
variant="contained"
color="primary"
onClick={() => window.location.href = "/"}
<Grid container spacing={8} alignItems="flex-end">
<Grid item md={true} sm={true} xs={true}>
<TextField
id="username"
label="Username"
type="email"
autoFocus
required
/>
</Grid>
</Grid>
<Grid
container
justify="flex-start"
style={{ marginTop: '24px', marginBottom: '24px' }}
>
Login
</Button>
<Button
variant="outlined"
color="primary"
style={{ textTransform: 'none' }}
>
Login
</Button>
</Grid>
</Fragment>
);
};