aboutsummaryrefslogtreecommitdiff
path: root/modern/src/StartPage.js
blob: 91b93c769c9c1c71af6ee7322f793718c9a3c403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import React from 'react';
import { useMediaQuery, makeStyles, Paper } from '@material-ui/core';
import { useTheme } from '@material-ui/core/styles';

const useStyles = makeStyles((theme) => ({
  root: {
    display: 'flex',
    height: '100vh',
  },
  sidebar: {
    display: 'flex',
    justifyContent: 'center',
    alignItems: 'center',
    color: theme.palette.secondary.contrastText,
    background: theme.palette.common.purple,
    paddingBottom: theme.spacing(5),
    width: theme.dimensions.sidebarWidth,
    [theme.breakpoints.down('md')]: {
      width: theme.dimensions.sidebarWidthTablet,
    },
    [theme.breakpoints.down('xl')]: {
      width: '0px',
    },
  },
  paper: {
    display: 'flex',
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',
    flex: 1,
    boxShadow: '-2px 0px 16px rgba(0, 0, 0, 0.25)',
    [theme.breakpoints.up('xl')]: {
      padding: theme.spacing(0, 25, 0, 0),
    },
  },
  form: {
    maxWidth: theme.spacing(52),
    padding: theme.spacing(5),
    width: '100%',
  },
  attribution: {
    position: 'absolute',
    bottom: theme.spacing(1),
    right: theme.spacing(1.5),
    fontSize: 'x-small',
    display: 'none',
  },
}));

const StartPage = ({ children }) => {
  const classes = useStyles();
  const theme = useTheme();

  return (
    <>
      <main className={classes.root}>
        <div className={classes.sidebar}>
          {!useMediaQuery(theme.breakpoints.down('xl'))
            && (
            <svg height="64" width="240">
              <use xlinkHref="/logo.svg#img" />
            </svg>
            )}
        </div>
        <Paper className={classes.paper}>
          <form className={classes.form}>
            { children }
          </form>
        </Paper>
      </main>
      <div className={classes.attribution}>
        Powered by&nbsp;
        <a href="https://www.traccar.org/">Traccar GPS Tracking System</a>
      </div>
    </>
  );
};

export default StartPage;