From 8b6623d0e5a7e528ce60bfabc2355a6499837530 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Tue, 13 Jul 2021 17:06:01 +0530 Subject: Minor Design and Code improvements --- modern/src/MainPage.js | 100 +++++++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 41 deletions(-) (limited to 'modern/src/MainPage.js') diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js index 9740227..e41cc33 100644 --- a/modern/src/MainPage.js +++ b/modern/src/MainPage.js @@ -1,7 +1,8 @@ import React, { useState } from 'react'; import { useHistory } from 'react-router-dom'; -import classnames from 'classnames'; -import { makeStyles, withWidth, Paper, Toolbar, Grid, TextField, IconButton, Button } from '@material-ui/core'; +import { + makeStyles, Paper, Toolbar, Grid, TextField, IconButton, Button, +} from '@material-ui/core'; import { useTheme } from '@material-ui/core/styles'; import useMediaQuery from '@material-ui/core/useMediaQuery'; @@ -48,15 +49,15 @@ const useStyles = makeStyles((theme) => ({ zIndex: 1301, height: '100%', maxHeight: `calc(100vh - ${theme.spacing(20)}px)`, - [theme.breakpoints.down("md")]: { + [theme.breakpoints.down('md')]: { top: theme.spacing(7), left: '0px', width: '100%', maxHeight: `calc(100vh - ${theme.spacing(14)}px)`, - } + }, }, paper: { - borderRadius: '0px', + borderRadius: '0px', }, toolbar: { paddingLeft: theme.spacing(2), @@ -68,25 +69,33 @@ const useStyles = makeStyles((theme) => ({ collapsed: { transform: `translateX(-${360 + 16}px)`, transition: 'transform .5s ease', - [theme.breakpoints.down("md")]: { - transform: `translateX(-100vw)`, - } + [theme.breakpoints.down('md')]: { + transform: 'translateX(-100vw)', + }, }, uncollapsed: { transform: `translateX(${theme.spacing(1.5)})`, transition: 'transform .5s ease', - [theme.breakpoints.down("md")]: { - transform: `translateX(0)`, - } + [theme.breakpoints.down('md')]: { + transform: 'translateX(0)', + }, }, deviceButton: { position: 'absolute', left: theme.spacing(1), top: theme.spacing(10.5), borderRadius: '0px', - [theme.breakpoints.down("md")]: { + [theme.breakpoints.down('md')]: { + left: theme.spacing(0), top: theme.spacing(7), - } + }, + }, + deviceButtonBackground: { + backgroundColor: 'white', + color: '#777777', + '&:hover': { + backgroundColor: 'white', + }, }, bottomMenuContainer: { position: 'absolute', @@ -94,11 +103,11 @@ const useStyles = makeStyles((theme) => ({ bottom: theme.spacing(1.5), width: theme.dimensions.drawerWidthDesktop, zIndex: 1301, - [theme.breakpoints.down("md")]: { + [theme.breakpoints.down('md')]: { bottom: theme.spacing(0), left: '0px', - width: '100%' - } + width: '100%', + }, }, menuButton: { display: 'flex', @@ -108,10 +117,10 @@ const useStyles = makeStyles((theme) => ({ fontSize: '0.75rem', fontWeight: 'normal', color: '#222222', - } + }, })); -const MainPage = ({ width }) => { +const MainPage = () => { const classes = useStyles(); const history = useHistory(); const theme = useTheme(); @@ -123,7 +132,7 @@ const MainPage = ({ width }) => { const handleClose = () => { setCollapsed(!collapsed); - } + }; return (
@@ -135,48 +144,57 @@ const MainPage = ({ width }) => { - {collapsed && - - } + )}
- + - {matchesMD && + {matchesMD && ( + - - } + + + )} setDeviceName(event.target.value)} + onChange={(event) => setDeviceName(event.target.value)} placeholder="Search Devices" - variant='filled' /> + variant="filled" + /> history.push('/device')}> - {!matchesMD && + {!matchesMD && ( + - } + + )} @@ -196,25 +214,25 @@ const MainPage = ({ width }) => { {t('reportReplay')} - + {t('reportTitle')} - + Options - + {t('settingsUser')} - + @@ -224,4 +242,4 @@ const MainPage = ({ width }) => { ); }; -export default withWidth()(MainPage); +export default MainPage; -- cgit v1.2.3